Android: How Can I Scrape Images (in Url) Using Jsoup? (Image Tag Contain Attribute "data-original" Which Is Url Of Image)
I am try to use JSoup to get the contents of this url 'http://binscorner.com/pages/t/timesofindiacartoons.html' which is contain cartoon images but in image tag have url of image.
Solution 1:
Do like @Mike said
Code
Document document = Jsoup.parse(html);
Elements images = document.select("img");
for (Element image : images) {
String imageUrl = image.attr("data-original");
System.out.println(imageUrl);
}
Result
http://binscorner.com/mails//t/timesofindiacartoons/part-003.jpeg
http://binscorner.com/mails//t/timesofindiacartoons/part-004.jpeg
http://binscorner.com/mails//t/timesofindiacartoons/part-005.jpeg
http://binscorner.com/mails//t/timesofindiacartoons/part-006.jpeg
Solution 2:
I would try to get all img
tags by doing a select("img")
and then get the attributes you like with attr("data-original")
.
For a tutorial see this: http://jsoup.org/cookbook/extracting-data/example-list-links
Post a Comment for "Android: How Can I Scrape Images (in Url) Using Jsoup? (Image Tag Contain Attribute "data-original" Which Is Url Of Image)"