简体   繁体   English

使用jsoup读取HTML

[英]Reading HTML using jsoup

so i am trying to get an HTML element from a website using Jsoup , but the HTML that i get from the Jsoup.connect(url) is not complete compared to the one that i get using the inspector on the website. 因此,我尝试使用Jsoup从网站获取HTML元素,但是与从网站上使用检查器获取的HTML元素相比 ,我从Jsoup.connect(url)获取的HTML并不完整。

EDIT : this is the link i'm working with https://www.facebook.com/livemap#@35.831640894,24.82275312499999,2z 编辑:这是我正在使用的链接https://www.facebook.com/livemap#@35.831640894,24.82275312499999,2z

The numbers in the end designate the coordinates of the map, and you don't have to sign in to access the page, so there is no authentication problem 最后的数字指定地图的坐标,并且您无需登录即可访问页面,因此没有身份验证问题

UPDATE : 更新:

So i have found that the element that i want does not get expanded using jsoup, is this a problem related to slow page loading ? 所以我发现我想要的元素没有使用jsoup扩展,这是与页面加载缓慢有关的问题吗? If so, how can i make sure that Jsoup.connect(url) fully loads the webpage before fetching the HTML 如果是这样,我如何在获取HTML之前确保Jsoup.connect(url)完全加载网页

from inspector (the <div id="u_0_e"> is expanded) 来自检查器( <div id="u_0_e">已展开)

from jsoup.connect (the <div id="u_0_e"> is not expanded) 来自jsoup.connect( <div id="u_0_e">未展开)

Jsoup不执行javascript或jQuery事件,因此您将在执行javascript之前获得初始页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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