I have string that contains this data:
<div>
<a href='https://www.some.html'>
<img src='https://besttv232.jpg' alt='null' title='null' border='0' width='100' height='56'>
</a>
</div>
Some text is also over here
I need to parse it with Jsoup, I need the a href url, img url and the data (Some text...)
Ive tried with:
Document doc = Jsoup.parse(myData); //myData is string with content above
Elements links = content.get("div");
for (Element link : links) {
String linkHref = link.attr("href");
String linkHrefa = link.attr("img");
String linkText = link.text();
}
I need the a href url
Element a = doc.select("a").first();
String src = a.attr("href");
img url
Element img = doc.select("img").first();
String src = img.attr("src");
data
String content = doc.body().text();