Answer the question
In order to leave comments, you need to log in
How to speed up JSOUP for web scraping?
In general, I decided to try to parse using jsoup. Here is the code:
package org.my.parse;
import org.jsoup.Jsoup;
import org.jsoup.helper.Validate;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
/**
* Example program to list links from a URL.
*/
public class Parse {
public static void main(String[] args) throws IOException {
String url = "https://www.olx.ua/obyavlenie/novaya-kvartira-remont-2016-goda-IDn1Xw4.html#dddea08ac8;promoted";
System.out.printf("Fetching %s...\n", url);
Document doc = Jsoup.connect(url).get();
String newSelector = "#offerdescription > div.clr.descriptioncontent.marginbott20 > table > tbody > tr:nth-child(2) > td:nth-child(2) > table > tbody > tr > td > strong";
Elements links = doc.select(newSelector);
System.out.println(links.text());
System.out.println("End");
}
}
Answer the question
In order to leave comments, you need to log in
Switching to XPath
nothing really will not change. What is DOM
it.
I see two options:
Jsoup
as http library, take apache http or google http clientDidn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question