ccagrawal / nbatools Goto Github PK
View Code? Open in Web Editor NEWScraper for NBA data
Scraper for NBA data
It appears that functions are hanging again and not returning the expected dataframes. More than likely due to header changes. I've been using another package (nbastatsr
) that uses the following headers:
headers <- c(
`Host` = 'stats.nba.com',
`User-Agent` = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv =72.0) Gecko/20100101 Firefox/72.0',
`Accept` = 'application/json, text/plain, */*',
`Accept-Language` = 'en-US,en;q=0.5',
`Accept-Encoding` = 'gzip, deflate, br',
`x-nba-stats-origin` = 'stats',
`x-nba-stats-token` = 'true',
`Connection` = 'keep-alive',
`Referer` = 'https =//stats.nba.com/',
`Pragma` = 'no-cache',
`Cache-Control` = 'no-cache'
)
If possible, could you give this header a try to see if it fixes the hanging API calls? The other package that I'm using unfortunately does not have a function for the synergytables that I'm after.
Thank you!
DT
Yesterday I tried running the GetGameLogs
function and in return I did not get an output (same thing today). The function just hangs for a while and does not return the expected game logs. I've been following the same issue as reported in the nba_api for Python and the issues seems to be related to the fact that NBA API headers have changed (again). I manually added the following fields to the headers and the function returned the expected game logs:
'x-nba-stats-origin' = 'stats',
'x-nba-stats-token' = 'true'
Working NBA headers:
'NBA' = list(
'Accept' = 'application/json, text/plain, */*',
'Accept-Language' = 'en-US,en;q=0.8,af;q=0.6',
'Referer' = 'http://stats.nba.com/%referer%/',
'User-Agent' = paste('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6)',
'AppleWebKit/537.36 (KHTML, like Gecko)',
'Chrome/67.0.3396.99 Safari/537.36'),
'x-nba-stats-origin' = 'stats',
'x-nba-stats-token' = 'true'
)
I'm not familiar with how GitHub works as far as making changes to other people's work. I figured if I made you aware of the change in the headers and the fix it would be easy for you to update the package on your end with the new headers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.