Re: What url you need to log in to and how you can get cookies and download data through JSL login.I'm not a VB user, but it appears like it should work in JMP using 3 newHttpRequests.
The three sections in the VB code end with a ".send".
The first section goes to a login page. Not sure why that might be necessary...it doesn't give you the cookie but might be required to visit it first.
The second section sends the post_data to a URL that will give you a cookie that means you are logged in.
JMP's httprequest may persist that data for you. Or you might need to tell httprequest to write it to a file and then grab it out of the file.
The (2) gets the cookie's value from some sort of VB structure.
The third section uses the URL to get some data and supplies the cookie as your credential. JMP may do that for you.
// get a cookie
try(deletefile("$temp/cookie.txt"));
s = New HTTP Request(
URL( "http://httpbin.org/cookies/set/aaa/bbb" ),
Method( "GET" ),
Headers( {"Accept: application/json", "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0"} ),
cookiefile("$temp/cookie.txt")
);
data = s << Send;
show(loadtextfile("$temp/cookie.txt"));
// send a cookie
s = New HTTP Request(
URL( "http://httpbin.org/cookies" ),
Method( "GET" ),
Headers( {
"Accept: application/json",
"Cookie: PHPSESSID=298zf09hf012fh2; csrftoken=u32t4o3tb3gg43; _gat=1",
"User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0"
} )
);
data = s << Send;
Show( data ); // note the aaa cookie was persisted
Re: What url you need to log in to and how you can get cookies and download data through JSL login.
I have tried many times but there is no way to directly log in and download the full data.
I found a Python code on the Internet, but it still didn't work out.

Re: What url you need to log in to and how you can get cookies and download data through JSL login.class AllcontentSpider(scrapy.Spider):
name = 'allcontent'
headers = {
'Host': 'www.jisilu.cn', 'Connection': 'keep-alive', 'Pragma': 'no-cache',
'Cache-Control': 'no-cache', 'Accept': 'application/json,text/javascript,*/*;q=0.01',
'Origin': 'https://www.jisilu.cn', 'X-Requested-With': 'XMLHttpRequest',
'User-Agent': 'Mozilla/5.0(WindowsNT6.1;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/67.0.3396.99Safari/537.36',
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
'Referer': 'https://www.jisilu.cn/login/',
'Accept-Encoding': 'gzip,deflate,br',
'Accept-Language': 'zh,en;q=0.9,en-US;q=0.8'
}
def start_requests(self):
login_url = 'https://www.jisilu.cn/login/'
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Encoding': 'gzip,deflate,br', 'Accept-Language': 'zh,en;q=0.9,en-US;q=0.8',
'Cache-Control': 'no-cache', 'Connection': 'keep-alive',
'Host': 'www.jisilu.cn', 'Pragma': 'no-cache', 'Referer': 'https://www.jisilu.cn/',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0(WindowsNT6.1;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/67.0.3396.99Safari/537.36'}
yield Request(url=login_url, headers=headers, callback=self.login,dont_filter=True)
def login(self, response):
url = 'https://www.jisilu.cn/account/ajax/login_process/'
data = {
'return_url': 'https://www.jisilu.cn/',
'user_name': config.username,
'password': config.password,
'net_auto_login': '1',
'_post_type': 'ajax',
}
yield FormRequest(
url=url,
headers=self.headers,
formdata=data,
callback=self.parse,
dont_filter=True
)
def parse(self, response):
for i in range(1,3726):
focus_url = 'https://www.jisilu.cn/home/explore/sort_type-new__day-0__page-{}'.format(i)
yield Request(url=focus_url, headers=self.headers, callback=self.parse_page,dont_filter=True)
def parse_page(self, response):
nodes = response.xpath('//div[@class="aw-question-list"]/div')
for node in nodes:
each_url=node.xpath('.//h4/a/@href').extract_first()
yield Request(url=each_url,headers=self.headers,callback=self.parse_item,dont_filter=True)
def parse_item(self,response):
item = JslItem()
title = response.xpath('//div[@class="aw-mod-head"]/h1/text()').extract_first()
s = response.xpath('//div[@class="aw-question-detail-txt markitup-box"]').xpath('string(.)').extract_first()
ret = re.findall('(.*?)\.donate_user_avatar', s, re.S)Re: What url you need to log in to and how you can get cookies and download data through JSL login.This is beyond the scope of this forum. Perhaps the site provides an API for what you want to do.
I think the site uses javascript to help verify you are properly logged in. JMP does not run the javascript.
The captcha may be part of the problem, and may require human interaction.
If the user name or password contain special characters then it will need some sort of encoding.
The 413 error code might mean something else is wrong.
Re: What url you need to log in to and how you can get cookies and download data through JSL login.Please forgive my persistence.
I continue to try this subject.
It is found that this method can log in through script, and there is no prompt of login failure.
But I still won't analyze what's in it.
Thanks!

Re: What url you need to log in to and how you can get cookies and download data through JSL login.
Char To Blob( "~1F~8B~08~00~00~00~00~00~00~03~ABVJ~CEOIU~B2214~D6Q~CA-NW~B2Rz~BEg~D7~D3~0D~13~9FOY~F1~ACc~FB~D3~09~BD~CF:~A6=~ED_~FCd~F7~12%~1D~A5~94~C4~92D%~ABj~A5~E4~C4~82~92~E4~0C 3~AF4'~A7~B6~16~00x&~D1~03E~00~00~00", "ascii~hex" )
Re: What url you need to log in to and how you can get cookies and download data through JSL login.
kbz_newcookie=1; kbzw__user_login=7Obd08_P1ebax9aXwZKsmLCuprCTpYKvpuXK7N_u0ejF1dSeq8WhwtappqDaotqYq8TYqNStwtSapKusy6rNp8euxa-YrqXW2cXS1qCasZypl6iZmLKgzaLOvp_G5OPi2OPDpZalp5OguNnP2Ojs3Jm6y4Ksj6iyk8-wx5eoopWq6dzjx83G2cLc7JCllKunqJ-ZlMKqyq7Do5PkytvGlMDazOTboIK5yenm4N2Qp5miqaOcspyrkKeRr5fG2cfR092oqpywmqqY; kbzw__Session=mnijj070u2h083ms7ouuah9b22; Hm_lvt_164fe01b1433a19b507595a43bf58262=1652962728,1652966374,1653359409,1653375276; Hm_lpvt_164fe01b1433a19b507595a43bf58262=1653375282
Re: What url you need to log in to and how you can get cookies and download data through JSL login.Yes, I think the website depends on JavaScript for some of its security. I think you'll want to look at the other blog post on using Selenium. That way you can script an existing browser that works from jmp.Re: What url you need to log in to and how you can get cookies and download data through JSL login.And, if you still want to look at it, 1F8B is the gzip signature (because Accept-Encoding said gzip, among others.) You could use
blob=Char To Blob( "~1F~8B~08~00~00~00~00~00~00~03~ABVJ~CEOIU~B2214~D6Q~CA-NW~B2Rz~BEg~D7~D3~0D~13~9FOY~F1~ACc~FB~D3~09~BD~CF:~A6=~ED_~FCd~F7~12%~1D~A5~94~C4~92D%~ABj~A5~E4~C4~82~92~E4~0C 3~AF4'~A7~B6~16~00x&~D1~03E~00~00~00", "ascii~hex" );
write(blobtochar(Gzip Uncompress(blob)))
{"code":413,"msg":"缺少用户名或口令","data":{"captcha":null}}
Google Translate: "Missing username or password"
But I really think using Selenium might be a better answer. Browser Scripting with Python Selenium shows how to script login and page through some data, loading it into a data table.
Re: What url you need to log in to and how you can get cookies and download data through JSL login.Thank Craige!
I see. So that's it.
Unfortunately, I do not have Python installed on my computer and have not installed Python since USING JMP.
From this example alone, it seems that VBA is easier than Python to get cookies for web pages that need to be logged in.

Re: What url you need to log in to and how you can get cookies and download data through JSL login.It not work:
<BR />s = New HTTP Request( URL( "https://www.jisilu.cn/login" ), Method( "get" ) );
data = s << Send;
username = "lala";
password = "jmp";
jj = "return_url=http://www.jisilu.cn/&user_name=" || username || "&password=" || password || "&net_auto_login=1&_post_type=ajax";
h = [=> ];
h["Content-Type"] = "application/json";
h["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36";
h["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
s = New HTTP Request( URL( "https://www.jisilu.cn/webapi/account/login_process/" ), Method( "POST" ), JSON( jj ), Headers( h ) );
data1 = s << Send;
Re: What url you need to log in to and how you can get cookies and download data through JSL login.What did it do? Anything in the log window?
Show(data);
Show(s<
Show(s<
Show(s<
Show(s<
If you have Python code that works, why not use it?
Use the Python code to make a .csv file and import that into JMP.
You can call it from JMP, either with the Python interface or with RunProgram.
Same thing with a VB program to make a .csv file and import it.
Re: What url you need to log in to and how you can get cookies and download data through JSL login.
Re: What url you need to log in to and how you can get cookies and download data through JSL login.Browser Scripting with Python Selenium
Won't be easy, but it is possible. Until you get a captcha that must be solved.
What url you need to log in to and how you can get cookies and download data through JSL login.Hello everyone!
This site requires cookies to download the complete data. How do I get cookies and download data through JSL login?
Thanks!
VBA
Sub Post()
Dim User_agent, Response_Text, username, password, cookie, json
username = [d1]: password = [f1]
User_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
Post_data = "return_url=https%3A%2F%2Fwww.jisilu.cn%2Fdata%2Fcbnew%2F&user_name=" & jslencode(username) & "&password=" & jslencode(password) & "&aes=1&auto_login=0"
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "get", "https://www.jisilu.cn/login/", False
.setrequestheader "User-Agent", User_agent
.send
.Open "post", "https://www.jisilu.cn/webapi/account/login_process/", False
.setrequestheader "User-Agent", User_agent
.setrequestheader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
.send (Post_data)
cookie = Split(.getallresponseheaders, "Set-Cookie: ")(2)
.Open "get", "https://www.jisilu.cn/data/cbnew/detail_hist/" & ([b1] & ""), False
.setrequestheader "User-Agent", User_agent
.setrequestheader "cookie", cookie
.send "fprice=&tprice=&curr_iss_amt=&volume=&svolume=&premium_rt=&ytm_rt=&rating_cd=&is_search=N&market_cd%5B%5D=shmb&market_cd%5B%5D=shkc&market_cd%5B%5D=szmb&market_cd%5B%5D=szcy&btype=&listed=Y&qflag=N&sw_cd=&bond_ids=&rp=50&page=1"
Response_Text = .responsetext
Set json = JsonConverter.ParseJson(Response_Text)
End With
End SubAutomation and ScriptingQuality and Process EngineeringWindows