How to crawl a website after login in it with username and password

爱⌒轻易说出口 提交于 2019-12-03 21:23:04

your approach is for stateless web access. usually works for web services, while sites all stateful. u authenticate once and after that, they use the session key stored in your cookie to authenticate you. so it is required. u must send parameters that your browser is sending. try monitoring what your browser send to site with firebug, and reproduce that in your code

--update--

Jsoup.connect("url")
  .cookie("cookie-name", "cookie-value")
  .header("header-name", "header-value")
  .data("data-name","data-value");

u can add multi cookie | header | data. and there is function for adding values from Map.

to find out what must be set, add fire bug to your browser, they all have their default developer console which can be started with F12. go to the url u want to get data and just add all thing in there to your jsoup request. i added some images from your site result

i marked important part in red.

u can get required cookies in your code with sending these info to site and get cookie from that and after getting response.cookies you attach these cookies to every request u make ;)

p.s: change your password A.S.A.P

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!