How to pause before parsing in jsoup?

瘦欲@ 提交于 2020-01-17 03:49:12

问题


I need to pause my script before parsing (i want to wait for some information), but how can i do this in Jsoup?

I tried this:

link = Jsoup.connect("link").wait(100).get();

But this doesn't work for me.


回答1:


Usually the need for waiting arises when content is loaded via AJAX. Jsoup can't deal with such stuff, because it is not a browser. Jsoup simply interprets HTML. The connection stuff is more or less only a wrapper around Java connections.

I guess you need to either identify the AJAX calls directly and get the contents of the AJAX calls, or you can use a real browser, i.e. selenium with phantomjs or similar.



来源:https://stackoverflow.com/questions/42614833/how-to-pause-before-parsing-in-jsoup

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