Over the course of a couple days, I will be adding more info.
After going through the network traffic of NHL's services, I have compiled a list of URLs that the NHL uses to obtain stats for certain players, teams, standings, etc... Best of all, all of this data is free and does not require any sort of API Key or anything of that nature.
This data came from the network traffic of NHL.com on a PC, NHL Gamecenter App on an iPhone, and TSN's iPhone App. There is no HTML/Web scraping involved
- Updates way quicker than the data for the specified day (http://live.nhle.com/GameData/GCScor...13-01-31.jsonp) and contains Team ID's, Player's currently on the ice (gives their jersey numbers), Shots and goals for each team separated by the total or by period, current game time (in seconds in the sr listing), most recent event/play.
- Recommended for in depth recent in-game plays and player stats. Contains recent events (it does not contain all of the events!), goal summary (goal scorer, assists, time, id, teams involved, type of play (you can find the alphabetical equivalents that correspond to the numbers on a script the NHL has which will be discussed below), penalty summary, and the only way to obtain the game stats for each player in the game according to their jersey number (the NHL.com Player ID is not necessary).
- For each player it includes their Assists, Goals, PIM, Plus Minus, Shots, and Time On Ice for that game
PlayByPlay.jsonp is not used by the NHL.com at this current time but contains all of the plays of the game, and goal info; I don't know whether NHL.com will continue to update it in the future.
This gives a good outlook on the games happening that day and also provides the Game ID's. Game ID explanation below!
Game ID Explained:
For its web services, each game in the NHL is assigned a GameID which is needed in order to obtain/maintain data for that game. Here are a couple examples of GameIDs and their structure:
Year - 2011
Same Code - 02
Game Code - 0581
Year - 2012
Same Code - 02
Game Code - 0144
Year - 2013
Static Code - 02
Game Code - 0524
4 digits are necessary for the "Game Code" due to there being more than 999 games in a season; so if there is an extra 0 in the game code, ignore it when obtaining video highlights (significant digits).
So, the gameid would be contructed like so:
$gameid = "$year 02 $gamecode"; PHP
int gameid = year + "02" + gamecode; C++/C
NOTE: For Neulion's Video Highlight service (which the NHL uses to manage NHL Game Center), you use the significant digits of the Game Code specified above. So if the game code is 0815, then in the video highlight URL, it will be 815.
This does not require the Game Center Live subscription!
/2014/ - Year of the game
/01/ - Month of the game
/30/ - Day of the game
/815/ - Game code (last 3 digits of the gameid)
2_ - It is a static value, always 2
815_ - Game code (last 3 digits of the gameid)
sjs_ - Away team (San Jose Sharks)
cgy_ - Home team (Calgary Flames)
1314_ - Game season (2013 - 2014)
h_discrete_ - Static value
CGY - Home team (Calgary Flames)
475_ - Highlight ID (You can obtain this from PlayByPlay.jsonp, gcbx.jsonp, gcsb.jsonp etc...)
goal_ - Type of highlight (Goal, save, hit etc...)
1_ - I don't really know what this value stands for, it is either 1 or 2
1600 - Bitrate of the highlight (This is the only bitrate available)
For hockeygoalies.org, I've always pulled all of my data by hand, just because I've seen enough errors in the data to cause me doubt.
I'd still love to learn more about how to automate the process.
Wow, I give you massive credit for doing that all manually.
You could create a PHP Server Side script that runs once a day/week/hour etc.. that checks the roster of the teams that played that day (or every single team roster) and get the stats of the goalies. You would then put that data into a MySQL database that your web page would gather info from when a user visits it.
You would have to tweak your website though since in order to extract data from MySQL, you would have to use a server side language like PHP which would then "echo" the tables with the stats.
This PHP script generates a live scoreboard image based upon the parameters "gameid" and "date" on the url. It finds the team names, score, shots, plays, and logos, generates it and presents it to the user every single time the page is reloaded. Unlike HTML, it is impossible to see the source code of PHP since it runs server side. PHP files can also generate HTML documents pretty easily so it shouldn't be too much of a task.
<title>Calgary Flames Goalie Stats</title>
<h1>CALGARY FLAMES GOALTENDING HISTORY: YEAR-BY-YEAR</h1>
// PHP Code:
// Extract the data from your database and generate the appropriate tables with the data
To avoid the website reloading when going to a new page, you can use an AJAX call to post and receive the data from a PHP script. Efficiency
BM-2cWtfN2gqGPpJ6zREgpgmpbJCbiDCQuDZY NHL Standings Under Different Point Systems @HockeyStandings
I do PHP/MySQL on my database side of things. Part of the downside of creating my site in 1994 was that I continued to update the page incrementally, so by the time I went to "databaseize" it, it took me more than two years.
I still need a lot of practice pulling things down from other websites, though. That's next on the old Doug's new trick list.
I have a really good use for this data once I figure it out!
This is the raw data for their NHL GameCenter Website/App services, there is no documentation (unless you worked on the infrastructure) but if you don't understand what a certain attribute means, feel free to ask; shouldn't take too long for me to analyze.
Remember that the URL you linked above is in JSONP and thus needs the "loadScoreboard(***DATA***)" to be removed in order to parse it as JSON.
You use PHP, so here is how you convert the JSONP to JSON: