martin wrote:ToddBot, could you remind me what url you use to grab this? thanksToddTT wrote:😑
1 2 3 4 T
-- -- -- -- ---
Hornets 20-46 21 29 37 25 112
Knicks 39-27 21 45 23 16 105STARTERS MINS PTS FG 3PT FT OFF DEF REB AST TO STL BLK PF +/-
-------------------- ---- ---- ----- ----- ----- --- --- --- --- --- --- --- --- ---
K. Oubre Jr. G 35 27 10-17 3-6 4-4 1 4 5 2 1 0 1 5 7
T. Rozier G 38 25 10-22 2-7 3-3 1 4 5 6 0 1 0 3 20
P. Washington F 29 13 5-10 2-5 1-2 2 5 7 2 2 1 2 5 9
G. Hayward F 36 23 9-17 3-6 2-3 4 5 9 8 3 0 1 2 14
M. Williams C 27 7 3-4 0-0 1-4 1 2 3 0 1 0 1 2 8
BENCH MINS PTS FG 3PT FT OFF DEF REB AST TO STL BLK PF +/-
-------------------- ---- ---- ----- ----- ----- --- --- --- --- --- --- --- --- ---
D. Smith Jr. 23 3 1-6 1-3 0-0 0 5 5 6 2 0 0 1 -2
N. Richards 19 7 1-1 0-0 5-5 1 4 5 0 0 0 0 2 -3
B. McGowens 18 2 1-4 0-2 0-0 0 2 2 0 1 0 0 1 -16
J. Thor 9 5 2-4 1-3 0-0 0 1 1 2 0 0 0 0 -2
STARTERS MINS PTS FG 3PT FT OFF DEF REB AST TO STL BLK PF +/-
-------------------- ---- ---- ----- ----- ----- --- --- --- --- --- --- --- --- ---
Q. Grimes G 28 12 3-8 2-7 4-5 0 4 4 2 0 0 0 1 -5
I. Quickley G 35 14 5-16 3-10 1-1 2 1 3 5 2 0 0 2 -15
J. Randle F 35 16 5-17 2-9 4-6 1 7 8 3 2 0 0 4 -20
R. Barrett F 35 27 10-24 1-7 6-8 1 5 6 4 1 0 0 2 -10
M. Robinson C 31 14 7-8 0-0 0-0 3 5 8 0 1 1 1 3 -8
BENCH MINS PTS FG 3PT FT OFF DEF REB AST TO STL BLK PF +/-
-------------------- ---- ---- ----- ----- ----- --- --- --- --- --- --- --- --- ---
J. Hart 32 10 3-5 1-1 3-4 2 6 8 2 1 0 0 3 -1
I. Hartenstein 15 2 1-2 0-0 0-0 1 1 2 2 0 0 2 3 3
M. McBride 12 7 3-5 1-2 0-0 0 0 0 0 0 2 1 0 8
O. Toppin 12 3 1-4 1-4 0-0 0 0 0 0 0 0 0 0 13
For the record, there's gotta be a much easier way. But I was learning Python anyway, so...
Every game has a unique game ID, which I still manually grab from the address bar like a neanderthal.
For the Hornets game, data was at these two locations, for game ID 1051377...
https://sportsdata.usatoday.com/basketball/nba/scores/1051377
https://sportsdata.usatoday.com/basketball/nba/summary/1051377
The first URL wasn't good enough for scraping everything, because the scoreboard morphs/changes during, and after the game.
So I grab the player data from the first URL, and the scoreboard data from the second.
Another caveat... the player stats and scoreboard have lag on their website. The scoreboard is updated like a minute after reality. And what's worse, the player stats occasionally have a slightly longer lag time. So the player stats are not always completely in sync with their scoreboard.
Maybe you're just interested in scores, in which case, maybe the second URL is enough.
In any case, I grab the game ID, plug it into my Python script, and push a button.
BTW, I looked for available web API's, rather than scraping, but couldn't find any that provided all of the data I was looking for.
More info than you asked for.