Reputation: 2497
I am trying to parse the hot topics from google trends in this link
I tried doing this but the elements size are always 0..
Document doc = Jsoup.connect(url).get();
if (doc != null) {
Elements elements = doc..select("li");
for (int i = 0; i < elements.size(); i++) {
String strValue = elements.get(i).select("a").text();
}
}
Upvotes: 0
Views: 1309
Reputation: 1084
I think the problem is, you cannot parce the content properly. You can use this:
if (doc != null) {
Elements elements = doc.select("content");
for (int i = 0; i < elements.size(); i++) {
Element element = elements.get(i);
Document doc2 = Jsoup.parse(element.text());
Elements liElements = doc2.select("li");
for (Element liElemet : liElements) {
String strValue = liElemet.select("a").text();
}
}
}
Upvotes: 1