Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7129359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:14:04+00:00 2026-05-28T11:14:04+00:00

I am using JSOUP to scrape data from a table on a site that

  • 0

I am using JSOUP to scrape data from a table on a site that contains a name of the player and stats. I am able to scrape the name with success but when I run my iterato rthru th erow It is always picking up the same stats for each player

Any idea?

Site source:

<tr id="plyr22" class="pncPlayerRow playerTableBgRow0"><td class="playertableData">1</td><td class="playertablePlayerName" id="playername_22" style=""><a href="" class="flexpop" content="tabs#ppc" instance="_ppc" fpopHeight="357px" fpopWidth="490px" tab="null" leagueId="0" playerId="22" teamId="-2147483648" cache="true">Kobe Bryant</a>, LAL&nbsp;SG<a href="" class="flexpop" content="tabs#ppc" instance="_ppc" fpopHeight="357px" fpopWidth="490px" tab="1" leagueId="0" playerId="22" teamId="-2147483648" cache="true"><img src="http://g.espncdn.com/s/fbalm/12/images/icons/sml/news_recent.png" height="12" width="15" border="0" style="margin:0 6px 0 6px" title="Recent News" /></a></td><td class="sectionLeadingSpacer"></td><td class="playertableData">0.63</td><td class="playertableData">2.41</td><td class="playertableData">1.44</td><td class="playertableData">1.29</td><td class="playertableData">2.82</td><td class="playertableData">1.84</td><td class="playertableData">0.18</td><td class="playertableData">4.81</td><td class="playerTableSpacerCell"></td><td class="playertableData sortedCell">15.41</td></tr><tr id="plyr167" class="pncPlayerRow playerTableBgRow1"><td class="playertableData">2</td><td class="playertablePlayerName" id="playername_167" style=""><a href="" class="flexpop" content="tabs#ppc" instance="_ppc" fpopHeight="357px" fpopWidth="490px" tab="null" leagueId="0" playerId="167" teamId="-2147483648" cache="true">Joe Johnson</a>, Atl&nbsp;SG, SF<a href="" class="flexpop" content="tabs#ppc" instance="_ppc" fpopHeight="357px" fpopWidth="490px" tab="2" leagueId="0" playerId="167" teamId="-2147483648" cache="true"><img src="http://g.espncdn.com/s/fbalm/12/images/icons/sml/video_breaking.png" height="11" width="19" border="0" style="margin:0 6px 0 6px" title="Breaking Video" /></a></td><td class="sectionLeadingSpacer"></td><td class="playertableData">-0.62</td><td class="playertableData">1.70</td><td class="playertableData">3.41</td><td class="playertableData">0.41</td><td class="playertableData">1.48</td><td class="playertableData">0.79</td><td class="playertableData">0.04</td><td class="playertableData">2.27</td><td class="playerTableSpacerCell"></td><td class="playertableData sortedCell">9.47</td></tr><tr id="plyr265" class="pncPlayerRow playerTableBgRow0"><td 

Code:

public static void main(String[] args) throws IOException, SQLException,
        InterruptedException {
    Document doc = Jsoup.connect(html).get();
    String title = doc.title();
    System.out.println(title);
    int tdCount = 1;
    String name = null;
    Double stat1 = null;
    Double stat2 = null;
    Double stat3 = null;
    Double stat4 = null;
    Double stat5 = null;
    Double stat6 = null;
    Double stat7 = null;
    Double stat8 = null;
    Double stat9 = null;
    Double stat10 = null;

    Iterator<Element> trSIter = doc.select("table.playerTableTable")
            .iterator();
    while (trSIter.hasNext()) {
        Element trEl = trSIter.next().child(0);
        Elements tdEls = trEl.children();
        Iterator<Element> tdIter = tdEls.select("tr").iterator();
        boolean firstRow = true;
        while (tdIter.hasNext()) {

            Element tr = (Element) tdIter.next();
            if (firstRow) {
                firstRow = false;
                continue;
            }

            while (tdIter.hasNext()) {

                System.out.println("============================");
                Element tdEl = tdIter.next();
                name = tdEl.getElementsByClass("playertablePlayerName")
                        .text();
                System.out.println("Name: " + name);

                // System.out.println(tdEl);
                Elements tdsEls = tdEl.select("td.playertableData");
                Iterator<Element> columnIt = tdsEls.iterator();
                boolean firstRow1 = true;
                while (columnIt.hasNext()) {

                    Element td = (Element) columnIt.next();
                    if (firstRow1) {
                        firstRow1 = false;
                        continue;
                    }

                    while (columnIt.hasNext()) {

                        Element column = columnIt.next();
                        switch (tdCount++) {

                        case 1:
                            stat1 = Double.parseDouble(column.text());
                            break;
                        case 2:
                            stat2 = Double.parseDouble(column.text());
                            break;
                        case 3:
                            stat3 = Double.parseDouble(column.text());
                            break;
                        case 4:
                            stat4 = Double.parseDouble(column.text());
                            break;
                        case 5:
                            stat5 = Double.parseDouble(column.text());
                            break;
                        case 6:
                            stat6 = Double.parseDouble(column.text());
                            break;
                        case 7:
                            stat7 = Double.parseDouble(column.text());
                            break;
                        case 8:
                            stat8 = Double.parseDouble(column.text());
                            break;
                        case 9:
                            stat9 = Double.parseDouble(column.text());
                            break;
                        case 10:
                            stat10 = Double.parseDouble(column.text());
                            break;
                        }

                        // System.out.print(column.className()+":"+column.text()+",");
                        System.out.print("stat1: " + stat1 + " stat2: "
                                + stat2 + " stat3: " + stat3 + " stat4: "
                                + stat4 + " stat5: " + stat5 + " stat6: "
                                + stat6 + " stat7: " + stat7 + " stat8: "
                                + stat8 + " stat9: " + stat9 + " stat10: "
                                + stat10);
                    }
                }
                System.out.println();

            }
            System.out.println();

        }
    }
}

My OutPut

Player Rater – Free Fantasy Basketball – ESPN

Name: Kobe Bryant, LAL SG

stat1: 2.41 stat2: null stat3: null stat4: null stat5: null stat6: null stat7: null stat8: null stat9: null stat10: nullstat1: 2.41 stat2: 1.44 stat3: null stat4: null stat5: null stat6: null stat7: null stat8: null stat9: null stat10: nullstat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: null stat5: null stat6: null stat7: null stat8: null stat9: null stat10: nullstat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: null stat6: null stat7: null stat8: null stat9: null stat10: nullstat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: null stat7: null stat8: null stat9: null stat10: nullstat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: null stat8: null stat9: null stat10: nullstat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: null stat9: null stat10: nullstat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: null stat10: null

Name: Joe Johnson, Atl SG, SF

stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: nullstat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41

Name: Andre Iguodala, Phi SF, SG

stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41

Name: James Harden, OKC SG

stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41

Name: Monta Ellis, GS PG, SG

stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41

Name: Kevin Martin, Hou SG

stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41stat1: 2.41 stat2: 1.44 stat3: 1.29 stat4: 2.82 stat5: 1.84 stat6: 0.18 stat7: 4.81 stat8: 15.41 stat9: 1.7 stat10: 3.41

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:14:04+00:00Added an answer on May 28, 2026 at 11:14 am

    You forgot to reset tdCount when moving on to next row.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I scrape a site using jsoup I am getting extra values that I
I'm using jsoup to scrape some HTML data and it's working out great. Now
I'm using JSoup in an attempt to built valid XML from a couple of
how can i parse only text from a web page using jsoup using java?
I have some tasks on a site in php using nginx that I'm trying
I'm using JSONP to get data from a server. The more typical method of
I am trying to select, using Jsoup , a <div> that has multiple classes:
I'm using JSONP to load frequently updating score data from my CDN. The JSONP
I am trying to scrape data from a website which uses javascript to load
I`m using the following code post values using JSoup: Document document = Jsoup.connect(http://www......com/....php) .data(user,user,password,12345,email,info@tutorialswindow.com)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.