I was trying to parse my university website, to get a list of news (title + link) from main site. However, as I'm trying to parse a full website, links that I am looking for are nested deep in other classes, tables etc. Here's the code I tried to use:
String url = "http://www.portal.pwr.wroc.pl/index,241.dhtml";
Document doc = Jsoup.connect(url).get();
Elements links = doc.select("table.cwrapper .tbody .tr td.ccol2 div.cwrapper_padd div#box_main_page_news.cbox.grey div#dyn_main_news.cbox.padd2 div.nitem table.nitemt .tbody .tr td.nitemcell2 span.title_1");
ArrayList <String> listOfLinks = new ArrayList <String> ();
int counter = 0;
for (Element link : links) {
listOfLinks.add(link.text());
}
But it doesn't work. Is there a better way to get a href values and titles of all those links, if every one of them is placed in:
<span class = "title_1">
<a href="Link Adress">Link Title</a>
</span>
Maybe some kind of loop, that would iterate over all of those tags, taking values from them?
Thanks for help :-)