import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.Jsoup;
import org.jsoup.select.Elements;
import java.net.URL;
import java.io.IOException;
public class JSoupExample {
public static void main(String[] args) throws IOException {
URL url = new URL("http://selcukoglu.blogspot.com/");
System.out.println("URL : " + url.toExternalForm());
Document doc = Jsoup.parse(url, 3 * 1000);
Elements types = doc.select("link[type]");
System.out.println("Size : (" + types.size() + ")");
for (Element link : types) {
System.out.println("*");
System.out.println(" link[type] : " + link.tagName());
System.out.println(" href : " + link.attr("abs:href"));
System.out.println(" rel : " + link.attr("rel"));
}
}
}
No comments:
Post a Comment