Reading title and description of URL using jsoup

This is a sample program to read title and description of specified url.
Wh have used java html parser jsoup for this program.
for that you have to include jsoup-1.7.2.jar(used in this program).

First we have to connect to url using

Document doc Jsoup.connect(url).get();

To get title call title() that will return String value

String title=doc.title();

To select meta with description and attribute content we use following code

String description = doc.select(“meta[name=description]”).get(0).attr(“content”);

To select first description we use following snippet

Element meta = doc.select(“meta[name=description]”).first();

Result