samedi 30 janvier 2016

Java HTML parsing (links)

I am trying to parse a web site and get some content from it, but I am completely lost now, I am trying to get all the links from the <div class="block block--archive"> there is <a class="block_link" hrek = "/curator/christoffer-rostlund-jonsson/" I want to get these links, I have searched a lot for some guides about it, but could not find any specific answer. I have tried something but I know its in really stupid way and doesnt work:

public static void main(String[]args) throws IOException {
      Document doc = Jsoup.connect("http://ift.tt/LkcgU2").get();
      Elements articles = doc.select("body");
       Elements element2= articles.select("div");
        Elements element3 = element2.select("article");
        Elements element4 = element3.select("div");
        System.out.println(element4.toString());
        }

And here is the structure of the web site that I want to get the links from: enter image description here




Aucun commentaire:

Enregistrer un commentaire