Skip to content

Instantly share code, notes, and snippets.

@GiovanniGrieco
Last active January 24, 2016 14:24
Show Gist options
  • Save GiovanniGrieco/f4934c19cbe7969f0656 to your computer and use it in GitHub Desktop.
Save GiovanniGrieco/f4934c19cbe7969f0656 to your computer and use it in GitHub Desktop.
ITALIAN - Questo script scarica la puntata "Imagine - Saviano racconta il 2015", mandata in onda a dicembre 2015. Non sfrutta alcuna hack, infatti utilizza il metodo di streaming di brightcove e salva lo stream in locale.
#!/bin/sh
printf "Downloading metadata...\n"
url=$(curl -s "http://c.brightcove.com/services/mobile/streaming/index/master.m3u8?videoId=4677882746001" | grep http | tail -1)
i=0
curl -s "$url" | grep http > TSList.m3u8
cat TSList.m3u8 | while read -r line; do
printf -v out "fragment_%05d.ts" $i
printf "Downloading fragment %d / 494\r" $i
curl -s "$line" -o $out
i=$((i+1))
done
printf "Download finished!\t\t\n"
printf "Merging...\r"
cat *.ts > Saviano.ts
rm TSList.m3u8 fragment_*.ts
printf "Completed!\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment