添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
飞翔的饺子  ·  jsoup - Tutorial·  2 周前    · 
逃课的滑板  ·  Central Repository: ...·  2 周前    · 
活泼的棒棒糖  ·  getting ...·  2 周前    · 
朝气蓬勃的茶叶  ·  Central Repository: ...·  2 月前    · 
苦闷的手套  ·  Spicy sweet potato ...·  1 月前    · 
帅呆的拖把  ·  PyMuPDF Python API ...·  2 月前    · 
奔放的梨子  ·  When is it safe to ...·  6 月前    · 

1.2. Using jsoup

The latest version of jsoup can be found via https://search.maven.org/artifact/org.jsoup/jsoup .

To use jsoup in a Maven build, add the following dependency to your pom.

<dependency>
  <groupId>org.jsoup</groupId>
  <artifactId>jsoup</artifactId>
  <version>1.13.1</version>
</dependency>

To use jsoup in your Gradle build, add the following dependency to your build.gradle file.

implementation 'org.jsoup:jsoup:1.13.1'
import org.jsoup.Jsoup ; import org.jsoup.nodes.Document ; import org.jsoup.nodes.Element ; import org.jsoup.select.Elements ; public class ParseLinksExample { public static void main ( String [] args ) { Document doc ; try { doc = Jsoup . connect ( "https://www.vogella.com/" ). get (); // get title of the page String title = doc . title (); System . out . println ( "Title: " + title ); // get all links Elements links = doc . select ( "a[href]" ); for ( Element link : links ) { // get the value from href attribute System . out . println ( "\nLink : " + link . attr ( "href" )); System . out . println ( "Text : " + link . text ()); } catch ( IOException e ) { e . printStackTrace ();

If you need more assistance we offer Online Training and Onsite training as well as consulting

See License for license information .