I have a problem similar to those:
Is it possible to achive it in JSoup?
You are probably looking for calling ownText:
import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; public class Main { public static void main(String[] args) throws Exception { final Document document = Jsoup.parse("<html><head/><body><a href=\"#\" class=\"artist\">Soulive<span class=\"create-play\">Play</span></a></body></html>"); final Element elem = document.getElementsByAttributeValue("class", "artist").first(); System.out.println(elem.ownText()); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With