0

Does anyone have a clue on how to use jsoup in order to extract elements from a website.

I'm trying to extract text from a website but my problem is, it's not showing anything, can anyone who knows jsoup help me out. Jsoup is a java library for web scraping. I'm developing this App in android studio so I don't know if I can use python or Javascript. Code extract: Arraylist listItem = new Arraylist(); Document doc = Jsoup.connect(https://www.takealot.com).get(); Elements data = doc.select("li.result-item"); int size = data.size(); for(int x=0,x<size;x++) { String imageUrl = data.select("image").select("img").eq(x).attr("src"); String title = data.select("p-title").select("a").eq(x).attr("href"); listItem.add(new Object(title,imageUrl)); }

6th Sep 2020, 8:53 PM
Syabonga Mngadi
Syabonga Mngadi - avatar
1 Answer
+ 1
For web scraping I would suggest you to use python, javascript.its very easy to do. If you are urgent use this. Otherwise I don't know about JAVA. Hope someone give a reply. and also please provide code for these kind of queries most probably it will be a small mistake.
6th Sep 2020, 9:04 PM
Preyas
Preyas - avatar