leftos / nba-stats-tracker

An in-depth basketball statistical analysis tool, compatible with most leagues around the world, as well as the NBA 2K12 savegames.
Apache License 2.0
1 stars 5 forks source link

Issue in getSeasonTeamStats in BR.cs #1

Closed harikrishnank8 closed 11 years ago

harikrishnank8 commented 11 years ago

Now I know you've disabled this because of B-R possibly not liking people scraping their data, so I downloaded a copy for myself and thought I'd scrape the data for my own personal use (Yeah, I won't push out anything to the internet as I know B-R wouldn't like it and also because its your tool). I'm just an avid nba stats fan and I always wanted a tool (which had all the team and player data needed set up) that could generate stats-narratives based on box scores. Your tool fit my needs like a glove and hence I'm trying this out.

Anyhow, to get to the issue at hand, in the aforementioned function, In the below line

HtmlNode infobox = doc.DocumentNode.SelectSingleNode("//*[@id='info_box']");

It gives me the error "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" when debugging. I was hoping you could give me more input on what I would need to correct to get this working.

Once again, can I just say that your work with this tool is simply amazing and NBA stats buffs like me are going to spend eons enjoying the heck out of this tool. Thank you so much for your dedication and hard work.

Thanks, A fan

leftos commented 11 years ago

In short, B-R changes its format ever so slightly once in a while, and the parser breaks, as it needs to be provided with the new XPath to the proper tables in the relevant pages. If you're familiar with XPath and can understand what the code does and how it goes over the page, use FireBug in Firefox or any equivalent to see where the info_box element has moved, and change the code accordingly. If that's way over your head, I'll take a look at it myself soon.

However, since this is a disabled feature, it's not high priority. I do promise to take a look at it though.

I just wish B-R would respond to my attempts to contact them about data usage. I've tried twice, never got a response.

harikrishnank8 commented 11 years ago

Hi again Leftos

As soon as I posted that, that was exactly what I thought of doing. When I posted that, I had just gotten it to run for the first time. I'll try to figure it out on my own. Thanks for taking the time to respond. I'll try to figure it out on my own. I know you must have enough stuff on your hands to take this issue up. Let me try to do the needful, before you need to even bother about.

leftos commented 11 years ago

Well, if you fix it, do share the code that fixes it please, either by uploading the new file somewhere, or by forking and pull requesting. Cheers!

harikrishnank8 commented 11 years ago

Hi Leftos

Just wanted to give you a quick update. I used the XPath from, Firebug for the "info_box" div. That didn't seem to fix it either.

leftos commented 11 years ago

It's okay. I'll make sure to take a look at it myself later today.

leftos commented 11 years ago

I didn't notice any error in the line you mentioned, but other parts of the functions that grabbed and parsed the stats had been broken after changes in the codebase lately. I fixed everything I could find by some basic debugging. Latest commit is able to download the NBA stats just fine, as well as download box scores into the database.

If you're still having problems, open a new issue.