jldbc / pybaseball

Pull current and historical baseball statistics using Python (Statcast, Baseball Reference, FanGraphs)
MIT License
1.18k stars 322 forks source link

Retrieving SB data #383

Open teagenwilliams opened 9 months ago

teagenwilliams commented 9 months ago

I was wondering if there was a way to retrieve stolen base attempt data. All I'm really looking for is who was at the defensive positions, the base runners, and whether the attempt was successful or not.

ss77995ss commented 9 months ago

Does this page help? https://baseballsavant.mlb.com/leaderboard/catcher-throwing

You can see the stolen base attempts for each catchers and it'll contain Catcher Name, Pitcher Name, Runner Name and Fielder Name. But it looks like the fielder only contain the one who catch the ball which catcher thrown and you have to get those data base on the catcher not the runner.

Other than that I cannot figure out any method that can get the stolen data for now. Savant do have a page for baserunning but they only contain runner's data

BTW, if the first link helps your requirement. You could try to call this API on your own https://baseballsavant.mlb.com/leaderboard/services/catcher-throwing/657136?game_type=Regular&n=q&season_end=2023&season_start=2023&split=no&team=&type=Cat&with_team_only=1

Replace 657136 to any other catcher's playerId or change season_end=2023&season_start=2023 if you want to get other season's data. This API will provide the data you can get from the first link

samlafell commented 8 months ago

Hey all, I'm working on this and will submit a PR when I have something I think works. Also ran into another issue that prompted me to submit a bug for failing pytest.

But yeah, working on this ATM in case anyone else is as well and wants to collaborate