JSOUP to get a un ordered list

Viewed 7192

I am re posting this message. I am trying to extract a unordered list. In the previous question I have the fomrat incorrect. This website from where I am trying to extract the data is formatted correctly.

<ul>
<li>
<i>
<a class="mw-redirect" title="title1" href="yahoo.com">used to be a best email</a>
</i>
(1999)
</li>
<li>
<i>
<a title="title2" href="google.com">Best search enginee We Will Go</a>
</i>
(1999)
</li>
<li>
<i>
<a title="title3" href="apple.com">Best Phone</a>
</i>
(1990)
</li>
</ul>

I want to print:

title1

google.com

yahoo.com

= used to be a best email Best search email will go Bestphone

similarly all Hrefs.

I did see the JSOUP documentation.

Related Question: jsoup to get the data in a unorderedlist but that is having format issues.

I tried as suggested but it is not working

I tried:

Document doc = Jsoup.connect(url).get();             
Element link = doc.select("a").last();
String title1 = link.attr("title");

Issue is this is a big page with some information. in that there are many unordered lists..

1 Answers
Related