imoteb imoteb - 2 years ago 142
HTML Question

Jsoup link selection

I am trying to get all the links inside the

div class news column index
here is the structure of the html:

enter image description here

And here what I have tried but actually it doesnt give me any result, I dont really know why :///

Document doc = Jsoup.connect("").get();
Elements els ="#body > div > > ul");
for(Element e : els)

EDIT: this is the URL I am parsing:

Answer Source

This works fine for me:

String str=""; Document doc=Jsoup.connect(str).userAgent(" Mozilla//5.0 (Windows NT 6.1; WOW64) AppleWebKit//537.36 (KHTML, like Gecko) Chrome//49.0.2623.110 Safari//537.36").get();
Elements links ="li[class=news-column-list-item]");

for (Element link : links) {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download