更新时间:2023-12-03 21:22:52
登录由ajax处理。我正在使用chrome,所以这就是我所做的。
尝试从浏览器通过表单登录。按F12,然后按控制台。
您将看到类似这样的内容 XHR已完成加载:POSThttps://www.tickld.com/ajax/login.php。
。当您发出POST请求时,将其设置为放置在表单
标记的操作
参数中的URL 。
在这种情况下,不存在这样的url,因为它是由javascript处理的。
The signing in is handled by ajax. I'm using chrome, so this is what I did.
Try to login via the form from a browser. Press F12 and then press Console.
You will see something like this XHR finished loading: POST "https://www.tickld.com/ajax/login.php".
. When you make the POST request, you make it to the url that is placed in the action
parameter of the form
tag.
In this case, no such url exists, because it is handled by javascript.
试试这个并查看它是否有效。
Try this and see if it works.
Document document = Jsoup.connect("https://www.tickld.com/ajax/login.php")
.data("l_username", "myUsername")
.data("l_password", "myPassword")
.cookies(loginForm.cookies())
.post();
如果没有那么你可能需要使用一些无头浏览器(可以处理js执行)比如selenium webdriver。
If it doesn't then you might need to use some headless browser (which can handle js execution) like selenium webdriver.
更新
Connection.Response login = Jsoup.connect("https://www.tickld.com/signin")
.data("l_username", "myUsername")
.data("l_password", "myPassword")
.method(Connection.Method.POST)
.execute();
Document document = Jsoup.connect("http://www.tickld.com/user/chosimbaaaa")
.cookies(login.cookies())
.get();