Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
178 views
in Technique[技术] by (71.8m points)

Can't find table on website when using JSoup

So I'm pretty new to getting information from websites with JSoup and I've run into a problem where I can see the table that I want the data from on the website when I'm inspecting the website through chrome, but I can't find it in the HTML code nor can I find any tables when running my code in eclipse.

I've tried some other websites such as premier league and IMDB and the code seems to be running fine as I get the tables downloaded from them, but when trying this website I get nothing and I'm completely clueless : https://www.atg.se/spel/2021-01-20/dd/aby-solvalla/avd1

Am I missing something simple or are the tables from this website not reachable? The table that I'm interested in is the one called "DD-ODDS" which is second to bottom.

    Document doc = Jsoup.connect("https://www.atg.se/spel/2021-01-20/dd/aby-solvalla/avd2#").userAgent("Mozilla/5.0").get();
    Elements downloadedList = doc.getElementsByAttribute("table");
    System.out.println(downloadedList.size());

This is the code I'm currently running to test if I'm getting any matches and the System.out.println is there to see if there's any tables found on the website but the output is 0 (no tables found) no matter what I'm searching for. Printing the entire doc file and reading it manually doesn't seem to include any tables either which the IMDB top 250 movies did.

question from:https://stackoverflow.com/questions/65927592/cant-find-table-on-website-when-using-jsoup

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...