jsoup 没有得到完整的数据

jsoup don't get full data

我有一个项目供学校解析 Web 代码并将其用作数据库。当我尝试从 (https://www.marathonbet.com/en/betting/Football/) 中下载数据时,我没有全部下载?

这是我的代码:

Document doc = Jsoup.connect("https://www.marathonbet.com/en/betting/Football/").get();
Elements newsHeadlines = doc.select("div#container_EVENTS");

for (Element e: newsHeadlines.select("[id^=container_]")) {
    System.out.println(e.select("[class^=block-events-head]").first().text());
    System.out.println(e.select("[class^=foot-market]").select("[class^=event]").text());
} 

你得到的结果(这是最后一个显示的联赛):

Football. Friendlies. Internationals All bets Main bets
1. USA 2. Mexico 16 Apr 01:30 +124 7/5 23/10 111/50 +124

在她上面显示的是所有联赛。

为什么我没有得到完整的数据?感谢您的宝贵时间!

Jsoup 的默认正文响应限制为 1MB。您可以使用 maxBodySize(int)

将其更改为您需要的任何内容

Set the maximum bytes to read from the (uncompressed) connection into the body, before the connection is closed, and the input truncated. The default maximum is 1MB. A max size of zero is treated as an infinite amount (bounded only by your patience and the memory available on your machine).

例如:

Document doc = Jsoup.get(url).userAgent(ua).maxBodySize(0).get();

您可能想查看 Connection 中的其他选项,了解如何设置请求超时、用户代理等。