Last active
January 14, 2018 10:32
-
-
Save assafmo/c484c1c6a9026c017cb44c9e73b5c263 to your computer and use it in GitHub Desktop.
NBA.com gamerecaps page to highlights mp4
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
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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