Fossj117 / NBAdata

Contains scraper in R for grabbing NBA Sport Tracking Data
54 stars 39 forks source link

Where does this data come from? #1

Open kwinrowjr opened 7 years ago

kwinrowjr commented 7 years ago

Where does this data come from?

Is the below all that can be pulled? If not, what else what I pull?

pullup_address ="http://stats.nba.com/js/data/sportvu/pullUpShootData.js", drives_address ="http://stats.nba.com/js/data/sportvu/drivesData.js", defense_address ="http://stats.nba.com/js/data/sportvu/defenseData.js", passing_address ="http://stats.nba.com/js/data/sportvu/passingData.js", touches_address ="http://stats.nba.com/js/data/sportvu/touchesData.js", speed_address ="http://stats.nba.com/js/data/sportvu/speedData.js", rebounding_address ="http://stats.nba.com/js/data/sportvu/reboundingData.js", catchshoot_address ="http://stats.nba.com/js/data/sportvu/catchShootData.js", shooting_address ="http://stats.nba.com/js/data/sportvu/shootingData.js"

Fossj117 commented 7 years ago

It actually looks like there is a lot more (especially historical) data that you can access now from NBA stats website.

If you go to pages like this http://stats.nba.com/teams/traditional/ one and load up the stats with JS console open you can see the request it sends to pull the data now:

[image: Inline image 1]

The requests look something like this (you can paste this in your browser):

http://stats.nba.com/stats/leaguedashteamstats?Conference=&DateFrom=&DateTo=&Division=&GameScope=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Base&Month=0&OpponentTeamID=0&Outcome=&PORound=0&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerExperience=&PlayerPosition=&PlusMinus=N&Rank=N&Season=2015-16&SeasonSegment=&SeasonType=Regular+Season&ShotClockRange=&StarterBench=&TeamID=0&VsConference=&VsDivision=

If you vary params you should be able to pull various (historical) stats for different years with python / R etc. Results seem to come back in a similar JSON format.

Good luck!

On Wed, Feb 22, 2017 at 3:41 PM, Kelvin notifications@github.com wrote:

Where does this data come from?

Is the below all that can be pulled? If not, what else what I pull?

pullup_address ="http://stats.nba.com/js/data/sportvu/pullUpShootData.js", drives_address ="http://stats.nba.com/js/data/sportvu/drivesData.js", defense_address ="http://stats.nba.com/js/data/sportvu/defenseData.js", passing_address ="http://stats.nba.com/js/data/sportvu/passingData.js", touches_address ="http://stats.nba.com/js/data/sportvu/touchesData.js", speed_address ="http://stats.nba.com/js/data/sportvu/speedData.js", rebounding_address ="http://stats.nba.com/js/ data/sportvu/reboundingData.js", catchshoot_address ="http://stats.nba.com/js/ data/sportvu/catchShootData.js", shooting_address ="http://stats.nba.com/js/data/sportvu/shootingData.js"

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Fossj117/NBAdata/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AFJIWueJcthURQWWjMxsztevIHw11aENks5rfMeegaJpZM4MJWFN .

Fossj117 commented 7 years ago

Here's the screenshot that didn't come through from email:

image

kwinrowjr commented 7 years ago

man oh man, this is perfect thanks a lot

Fossj117 commented 7 years ago

@kwinrowjr cool no problem. If you wind up putting together a script to pull this data, feel free to add it here so others can use as well. I might do that if you don't

kwinrowjr commented 7 years ago

ok I plan to, I got some of what I am trying to do working but stuck on other parts. So basically I am trying to find a way to reference the individual player game logs by using the player name. When I go to the url: http://stats.nba.com/players/gamelogs/, I am able to click on the advance filter option. The to and from dates are able to be referenced from the request url but my issue is with the custom filter option. This is what I am trying to code below and it does not work, it does not show in the request url.

Code:

$(function() {
function loadStats() {

  $.ajax({
    url: 'http://stats.nba.com/players/gamelogs/'#!?&callback=?',
    jsonpCallback: 'jsonReturnData',
    dataType: 'jsonp',
    data: {
      CF: 'PLAYER_NAME*E*James Harden',
      Season: '2016-17',
      SeasonType: 'Regular Season',
      format: 'json'
    },
    success: function(response) {
      console.log(response);  
    } //success
  }); //AJAX Call
} 

loadStats();
});