hey guys really hit a roadblock here and hoping someone would be kind enough to spend a few minutes and have a look at this. i am working with numerous tables, yet only one is giving me a problem i just cannot solve despite my endless hours of trying. i know this is long, so please bear with me.
i have written a loop (included at the end of this post) that i am using to work with
this table (the same one i posted before) whose url contains an attribute called "SportGroup", which determines which sport table to display; for example: "&SportGroup=sg6" is ncaab, "sg1" is nfl, "sg2" is nba, at the end of a table url:
Code:
https://free.sportsinsights.com/free-odds/free-odds-frame.aspx?MaxColumns=100&LineOption=Combined&EventOption=undefined&SortBy=undefined&Previous=&Yesterday=&ShowPercents=&SportGroup=sg6
however no matter which sport table i connect to (in this case ncaab, or "sg6"), i can only extract table data from
all sports tables despite trying any and every combination of pseudo-selector. clicking on 'inspect' in the ncaab table, you can see each row uses one of two classes: ".row-odd" for rows relevant to the current ncaab table, and ".row-odd hidden" which hides rows related to all other sports. you'd think using a pseudo-selector for ".row-odd" while connecting my doc to the ncaab sport url above would extract only ncaab results, but instead i get results for
all sports (from all tables).
also under 'inspect' you can see each table row has an "id" attribute and a "name" attribute; however the "id" attributes for all sport types are just a bunch of randomly generated numbers which appear to have no distinct pattern toward a given sport (and thus appear essentially useless). and every "name" attribute = 0, so it seems there is no way to sort with either of these two remaining row attributes.
i have studied the html and some of the .js files and cannot seem to find anything which would allow me to sort these tables by sport; however i did notice that in the ncaab table url above there are two "undefined" attributes: one called "EventOption=undefined" and the other called "SortBy=undefined". i tried plugging in values like 1, 2, and 6 as well as ncaab, nfl, and nba with no success and also tried searching the page source for these attributes but found nothing useful... although maybe defining these attributes will solve my problem?
i'm out of ideas here and have really tried everything i can think of so maybe someone here can help. usually i would just avoid a table causing this much trouble however i need the available aggregated percentages listed for each team. hopefully there is a common solution to this problem that i'm just overlooking and not something related to __viewstate or something more difficult. huge thanks to anyone that helps or provides some insight. here's my table loop in case someone sees something i'm missing:
Code:
try
{
Document doc = Jsoup.connect("https://free.sportsinsights.com/free-odds/free-odds-frame.aspx?MaxColumns=100&LineOption=Spread&EventOption=undefined&SortBy=undefined&Previous=&Yesterday=&ShowPercents=&SportGroup=sg6").get();
for (Element table : doc.select(".tableOdds"))
{
for (Element trs : table.select("tr:not(.row-odd hidden)"))
{
Elements tds = trs.select("td");
if (tds.size() > 13)
{
System.out.println(tds.get(0).text() + " " + tds.get(1).text() + " "
+ tds.get(2).text() + " " + tds.get(3).text() + " "
+ tds.get(4).text() + " " + tds.get(5).text() + " "
+ tds.get(6).text() + " " + tds.get(7).text() + " "
+ tds.get(8).text() + " " + tds.get(9).text() + " "
+ tds.get(10).text() + " " + tds.get(11).text() + " "
+ tds.get(12).text() + " " + tds.get(13).text() + " "
+ tds.get(14).text());
}
}
}
}