简体   繁体   中英

Jsoup (connect) Java takes a long time

I'm trying to get a few lines of code from many html pages.

I'm using Jsoup and it takes over 2 minutes to go over 70+ html pages (90% of the time is spent on creating the new Document through jsoup.connect).

Is this normal? Would using another parser make any difference?

Document doc = Jsoup.connect(Url).timeout(10*1000).get();

I'm able to go through all the webpages.

The jsoup normally takes about 2 seconds to make connetion and to fetch html content

In case if the url is redirected to another site,then it may take up to 5 seconds.

May be some of the pages which you fetch may be redirected,set the timeout to 3 seconds,you may know what went wrong..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM