Skip to content

Instantly share code, notes, and snippets.

@assafmo
Last active January 14, 2018 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save assafmo/c484c1c6a9026c017cb44c9e73b5c263 to your computer and use it in GitHub Desktop.
Save assafmo/c484c1c6a9026c017cb44c9e73b5c263 to your computer and use it in GitHub Desktop.
NBA.com gamerecaps page to highlights mp4
#!/bin/bash
nba_date=$( \
curl 'https://data.nba.net/10s/prod/v3/today.json' --compressed -s | \
jq .links.anchorDate \
)
num_of_games=$( \
curl 'https://data.nba.net/prod/v2/calendar.json' --compressed -s | \
jq ".[$nba_date]" \
)
xmls=$( \
curl 'http://www.nba.com/video/gamerecaps' -s --compressed | \
grep -Po 'collection_uuid":".+?"' | \
awk -F '"' '{print $3}' | \
xargs -I {} -n 1 curl -s --compressed https://api.nba.net/0/league/collection/{} | \
jq . | \
grep contentXml | \
awk -F '"' '{print "https://www.nba.com"$4}' | \
head -"$num_of_games" \
)
echo "$xmls" | \
xargs -n 1 curl -s --compressed | \
grep -Po 'http://nba.cdn.turner.com/nba/big/video/.+?\.mp4' | \
grep -v '["<>]' | \
grep 1080 | \
sort -u
@assafmo
Copy link
Author

assafmo commented Jan 7, 2018

download & start watching immediately: ./nba_com_gamerecaps_to_mp4.sh | xargs -n 1 aria2c -c -s 8 -x 8 -k 1M --stream-piece-selector=inorder

@assafmo
Copy link
Author

assafmo commented Jan 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment