简体   繁体   中英

extract title, description and h1 form a url using jsoup

I want to extract the Title, description, H1 from a url in JAVA. i try the example here Get title, meta description content using URL but it pop-out an error: non-static method getMetaTag(org.jsoup.nodes.Document,java.lang.String) cannot be referenced from a static context

Does anyone now why?

This means that the method getMetaTag is not static and you are trying to call it directly from a static method.
An instance member can't be called directly by a static member
See it here: http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
Edit: Try to instantiate the class.

new YourClass().getMetaTag();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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