Last active
September 11, 2023 17:17
-
-
Save mkwatson/2174ec5f4c234c25cd993a1f59114a85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Base URL and HTTP method | |
# Query Parameters: | |
# - teamId=110 is for the Orioles | |
# - daysBack=-6 gathers data for the previous week | |
curl -G 'https://bdfed.stitch.mlbinfra.com/bdfed/stats/player' \ | |
--data-urlencode 'stitch_env=prod' \ | |
--data-urlencode 'season=2023' \ | |
--data-urlencode 'sportId=1' \ | |
--data-urlencode 'stats=season' \ | |
--data-urlencode 'group=hitting' \ | |
--data-urlencode 'gameType=R' \ | |
--data-urlencode 'limit=25' \ | |
--data-urlencode 'offset=0' \ | |
--data-urlencode 'sortStat=hits' \ | |
--data-urlencode 'order=desc' \ | |
--data-urlencode 'teamId=110' \ | |
--data-urlencode 'daysBack=-6' \ | |
| jq -r ' | |
.stats | |
| map( | |
select(.plateAppearances != 0) | |
| { | |
playerName, | |
plateAppearances, | |
gamesPlayed, | |
runs, | |
doubles, | |
homeRuns, | |
hits, | |
avg, | |
atBats, | |
slg, | |
rbi | |
} | |
) | (first | keys_unsorted) as $header | |
| [$header] + map([.[ $header[] ]]) | |
| map(.)[] | |
| @tsv' \ | |
| pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output looks like: