简体   繁体   English

使用JSOUP打开HTML中的链接

[英]Open Link in HTML with JSOUP

I have a table in a HTML page in which I have to iterate through to open the links into a next page where all the information is. 我在HTML页面中有一个表,在其中必须进行迭代以打开指向下一页所有信息所在的链接。 In this page I extract any data I need and return to my basic page. 在此页面中,我提取所需的任何数据并返回到我的基本页面。

How do I change pages with the framework JSoup in Java? 如何使用Java中的JSoup框架更改页面? Is it actually possible? 真的有可能吗?

If you look at the JSoup Cookbook , they have an example of getting all the links inside of an HTML element. 如果您查看JSoup Cookbook ,那么他们有一个将所有链接都获取到HTML元素内的示例。 Iterate the Elements from this example and do a Document doc = Jsoup.connect(<url from Elements>).get(); 重复此示例中的Elements并执行Document doc = Jsoup.connect(<url from Elements>).get(); . You can then do String htmlFromLink = doc.toString(); 然后,您可以执行String htmlFromLink = doc.toString(); and get the HTML from the link. 并从链接获取HTML。

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

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