Closed albertlyu closed 9 years ago
Awesome, thanks for the heads up! The shot log defender distance is super interesting. I'll try to get these in soon, or if you want to take a shot at it open up a PR – might not be able to get to it for a bit
Hi @nickb1080, sure! I'd love to give this a shot this week. Without npm install nba
-ing yet and looking strictly at the codebase, here's my guess at what I should be modifying:
endpoints
object, add shotLog
and reboundLog
properties with appropriate url
and transform
properties and defaults
functionendpoints
object, add shotLog
and reboundLog
properties with appropriate url
, defaults
, and transform
properties.shotLog()
and .reboundLog()
nba.js
to nba-min.jsnba.js
with nba-light.js as well, then minify to nba-light-min.jsSo this is all just a guess, and if you have the time, feel free to let me know if there's anything else I missed additionally. Also, which node module do you use to minify nba.js
? I'm also not exactly sure how else I can 'manually test' to make sure the scraping works. Do you simply run a bunch of getJSON
commands? Forgive me as I'm somewhat new to node, though I do have node and npm on my machines.
@albertlyu, looks like you'll need to do npm run build-all
, which uses UglifyJS to minify the code.
You can see that all in the package.json, as well as the other scripts for testing, linting, etc.
I also found a few more endpoints I didn't see listed, but correct me if I'm wrong. I'll try my best to implement these, as well, but am pretty new to node as well. :
http://stats.nba.com/stats/teamhistoricalleaders?LeagueID=00&SeasonID=22013&TeamID=1610612738
http://stats.nba.com/stats/teaminfocommon?LeagueID=00&Season=2014-15&SeasonType=Regular+Season&TeamID=1610612739
http://stats.nba.com/stats/commonteamroster?LeagueID=00&Season=2014-15&TeamID=1610612739
http://stats.nba.com/stats/teamplayerdashboard?DateFrom=&DateTo=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Base&Month=0&OpponentTeamID=0&Outcome=&PaceAdjust=N&PerMode=PerGame&Period=0&PlusMinus=N&Rank=N&Season=2014-15&SeasonSegment=&SeasonType=Regular+Season&TeamID=1610612739&VsConference=&VsDivision=
Hey guys, so basically the only source file you should have to modify is lib/endpoints.js
. Each endpoint gets made into an API method in lib/api.js
. Each endpoint is like
someMethod: {
url: "http://stats.nba.com/stats/somemethod",
defaults: function () {
return { /* object with defaults for this endpoint */ },
},
transform: /* transformation function applied to result before passing it back */
}
(I should really add a utility function that takes a query string and turns it into a default object.)
After adding to endpoints.js
, run npm build-all
to bundle up the code into the dist
directory. Tests on endpoints go in test/api-test.js
but, as you can see, they're not very comprehensive.
Thanks for the help, much appreciated!
Looks like #4 resolves this.
Hi there -- I just stumbled upon this repo thanks to a www.poundingtherock.com post, and wanted to make you aware of some endpoints that NBA.com recently added. I figured if you knew about them already, you could update your documentation, update your codebase to pull those in as well.
The nice thing about these new endpoints are that they are summarized SportVU data (at the player level) with the same object schema as all the other endpoints you've explored (with the
resource
andresultSets
properties and so on). They are:http://stats.nba.com/stats/playerdashptshotlog
http://stats.nba.com/stats/playerdashptreboundlogs
There's also
http://stats.nba.com/stats/videoevents
but it looks non-standard. Examples of the SportVU JSON:DeAndre Jordan shot logs: http://stats.nba.com/player/#!/201599/tracking/shotslogs/ JSON: http://stats.nba.com/stats/playerdashptshotlog?DateFrom=&DateTo=&GameSegment=&LastNGames=0&LeagueID=00&Location=&Month=0&OpponentTeamID=0&Outcome=&Period=0&PlayerID=201599&Season=2014-15&SeasonSegment=&SeasonType=Regular+Season&TeamID=0&VsConference=&VsDivision=
DeAndre Jordan rebound logs: http://stats.nba.com/player/#!/201599/tracking/reboundslogs/ JSON: http://stats.nba.com/stats/playerdashptreboundlogs?DateFrom=&DateTo=&GameSegment=&LastNGames=0&LeagueID=00&Location=&Month=0&OpponentTeamID=0&Outcome=&Period=0&PlayerID=201599&Season=2014-15&SeasonSegment=&SeasonType=Regular+Season&TeamID=0&VsConference=&VsDivision=
This data appears to be available for all of the 2013-14 season as well.