jsoup – Cant purse a table in HTML – Code Utility


I’m first time here. I can parsing table.
Need all Childs in class table_offers_day.

But my cod give me nothing.

enter image description here

Document document = Jsoup.parse(new URL(“https://www.ittour.com.ua”), 3000);
Elements elements = document.getElementsByClass(“table_offers_day”);



That content is not in the source — the content is loaded via a javascript ajax call. jsoup is a HTML parser and does not execute javascript. You can quickly check for this type of content by using your browser’s View Source vs Inspect. View Source shows the original HTML as delivered by the server and what jsoup can see. Inspect is the DOM after the browser has parsed it, fetched content remotely and added that to the DOM, etc…

If you use Inspect, view Network, and reload, you’ll see the json call to fetch that content. You can probably fetch it simply like that.

I think this approach (combining jsoup for HTML, and e.g. gson for json decoding) works well and can be more efficient than running a full headless browser as that will use a lot more network, memory, and CPU. But, it can be more work getting it set up, so that’s a tradeoff to review.