samedi 27 octobre 2018

How to extract url from html in java

I have the following code to extract text from https://www.rvparkstore.com/rv-parks-for-sale/usa , but how can I get the url. HTML HERE

look for

import java.io.IOException;
import java.io.IOException;
import java.util.Vector;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;


public class scraper {

        public static void main(String[] args) {
                // TODO Auto-generated method stub

                try {
                        Document doc = Jsoup.connect("https://www.rvparkstore.com/rv-parks-for-sale/usa").userAgent("Mozilla17u.0").get();
                        Elements urls = doc.select("div.span-9");
                        int i =0;
                        Object temp;
                        Vector<Element> urList = new Vector<Element>();
                        Elements imports = doc.select("link[href]");
                        Elements urls0 = urls.select("link[href]");
                        
                        i=urList.size();
                        
                        for(Element urlList:urls) {//urlList.
                                i++;
                                System.out.println(i+urlList.getElementsByTag("a").text());
                        }
                        
                        
                        
                } catch(IOException e) {
                    System.out.println(e);
                }
        }
}

mmmmmmmm mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm




Aucun commentaire:

Enregistrer un commentaire