Created
March 16, 2018 11:27
-
-
Save mwdchang/0b834bb77b7e2456b9a09962067161a3 to your computer and use it in GitHub Desktop.
Scrapes baseball reference player mug shots
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
#!/usr/bin/env bash | |
PLAYER_ID=$1 | |
IDX=${PLAYER_ID:0:1} | |
URL="https://www.baseball-reference.com/players/${IDX}/${PLAYER_ID}.shtml" | |
echo "$URL" | |
curl ${URL} | grep "og:image" | egrep -o "http.*((jpg)|(png))" | xargs curl -o ${PLAYER_ID} | |
sips -s format jpeg ${PLAYER_ID} --out ${PLAYER_ID}.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment