jstuckey / Nice-Time-on-Ice

Nice Time on Ice - Mashup of NHL game links
31 stars 7 forks source link

Scores #1

Closed Fever905 closed 10 years ago

Fever905 commented 10 years ago

This is awesome! Do you know of any way to get the game results? I'm more of a PHP programmer, so I"m going to try to take your results, use the links to get the boxscore page, and extract the data using CURL... if you know of another way that would be helpful. Good job overall.

jstuckey commented 10 years ago

Thanks, Fever! I'm not sure of a dead-simple way to do this.

If you know the season and game number, you can call this url to get the game links: http://www.nicetimeonice.com/api/seasons/20132014/games/2013020002/links. That will return a list of links for a particular game, including a link to the box score on NHL.com. Check out this page to see other available API calls: http://www.nicetimeonice.com/api

Scraping NHL.com is a pain, but it's doable. I used the BeautifulSoup python library, but I'm sure there are html scrapers out there for PHP.

Fever905 commented 10 years ago

There's no need to scrape, they provide JSON urls... just have to iterate through them and record the outcome..

I can use your service to get the game id's...

The NHL provides those json urls, but not any documentation for them.. are they meant for their own internal use or something?

Mike

Date: Fri, 7 Feb 2014 13:38:13 -0800 From: notifications@github.com To: Nice-Time-on-Ice@noreply.github.com CC: feverish30@hotmail.com Subject: Re: [Nice-Time-on-Ice] Scores (#1)

Thanks, Fever! I'm not sure of a dead-simple way to do this.

If you know the season and game number, you can call this url to get the game links: http://www.nicetimeonice.com/api/seasons/20132014/games/2013020002/links. That will return a list of links for a particular game, including a link to the box score on NHL.com. Check out this page to see other available API calls: http://www.nicetimeonice.com/api

Scarping NHL.com is a pain, but it's doable. I used the BeautifulSoup python library, but I'm sure there are html scrapers out there for PHP.

— Reply to this email directly or view it on GitHub.

jstuckey commented 10 years ago

Ah, I didn't realize you could get the box score as JSON data. Do you have an example link?

I think you're right. They just have that exposed for their own use. If they really wanted to open up this data, they would just make an API already. I bet they have no idea how many people are scraping their game logs.

Fever905 commented 10 years ago

Not full box score, just the scoreboard http://live.nhle.com/GameData/GCScoreboard/2013-02-01.jsonp

Date: Fri, 7 Feb 2014 15:12:28 -0800 From: notifications@github.com To: Nice-Time-on-Ice@noreply.github.com CC: feverish30@hotmail.com Subject: Re: [Nice-Time-on-Ice] Scores (#1)

Ah, I didn't realize you could get the box score as JSON data. Do you have an example link?

I think you're right. They just have that exposed for their own use. If they really wanted to open up this data, they would just make an API already. I bet they have no idea how many people are scraping their game logs.

— Reply to this email directly or view it on GitHub.

jstuckey commented 10 years ago

Thanks. Yeah, that's jsonp data. It's definitely for their own use.

Fever905 commented 10 years ago

May I ask how you get all your data? Is yours up to date?

Date: Fri, 7 Feb 2014 15:28:57 -0800 From: notifications@github.com To: Nice-Time-on-Ice@noreply.github.com CC: feverish30@hotmail.com Subject: Re: [Nice-Time-on-Ice] Scores (#1)

Thanks. Yeah, that's jsonp data. It's definitely for their own use.

— Reply to this email directly or view it on GitHub.

jstuckey commented 10 years ago

I have a script that runs daily and scrapes the schedule page: http://www.nhl.com/ice/schedulebyday

Fever905 commented 10 years ago

Awesome... Oh, you did that pyhon one?

Date: Fri, 7 Feb 2014 17:52:38 -0800 From: notifications@github.com To: Nice-Time-on-Ice@noreply.github.com CC: feverish30@hotmail.com Subject: Re: [Nice-Time-on-Ice] Scores (#1)

I have a script that runs daily and scrapes the schedule page: http://www.nhl.com/ice/schedulebyday

— Reply to this email directly or view it on GitHub.

jstuckey commented 10 years ago

Yup. This one, specifically: https://github.com/jstuckey/Nice-Time-on-Ice/blob/master/data/dailyscraper.py

Cellery72 commented 8 years ago

Hey I stumbled upon the API and love it, I noticed the lack of scores and looked into solving this and saw the closed Issue. Have you come up with an easy solution to use the gameid to find the box score of that game? I noticed NHL doesn't have a public API which I'm sure is your reasoning behind building this API. I noticed there's a lot of paid options but if we could come up with a way to use your gameid to find the boxscore (perhaps with a couple more properties than score) in a json object it would become invaluable to everyone looking to develop their own personal projects as opposed to making money from the project. Look forward to hearing your thoughts, like I said I love the API.

jstuckey commented 8 years ago

Hey, @Cellery72. Sorry I missed your comment last week!

I might take a stab at adding scores. I would probably do another scrape of the nhl.com schedule page to grab the scores after the games are finished for a given day.

Honestly, the API was just a proof of concept while I was making the overall website, so I'm a little wary about adding a bunch of fields. The boxscore is pretty useful though, so I'm open to adding it.

Cellery72 commented 8 years ago

Understandable! I just happened to stumble upon it a few weeks ago while looking at new API's to toy around with. Would be awesome to get the scores and that, I don't have much experience writing page scrapers otherwise I'd be willing to throw something together. I clicked the link above to your web scraper but it 404'd, did you remove it from the project?

jstuckey commented 8 years ago

Here's the original scraper: https://github.com/jstuckey/Nice-Time-on-Ice/blob/ntoi1/data/dailyscraper.py

I did a complete rewrite of this site recently since I didn't really know what I was doing the first time around. Part of that was redoing the scraper.