json爬虫获取列表数据不全,已解决

原链接的数据比较多,但是通过jsoup获取的数据差不多只有2000多条。

 Document document = Jsoup.connect(url)
         .timeout(4000)
         .ignoreContentType(true)
         .userAgent("Mozilla\" to \"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0)")
         .method(Connection.Method.POST)
         .get();

有两个地方可能导致.
①把timeout超时限制设置大一点,单位为毫秒,10s应该够长。
②另外把maxBodySize(0)设置为0,可以得到不限响应长度的数据。

 Document document = Jsoup.connect(url)
         .timeout(10000)
         .ignoreContentType(true)
         .userAgent("Mozilla\" to \"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0)")
         .method(Connection.Method.POST)
         .maxBodySize(0)
         .get();

猜你喜欢

转载自blog.csdn.net/qq_41885819/article/details/111017207
今日推荐