Last active
August 29, 2015 13:58
-
-
Save m4p/9931154 to your computer and use it in GitHub Desktop.
A bash script to download a twitch archive broadcast by its id number. needs axel and ffmpeg.
This file contains hidden or 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 | |
ID=$1 | |
DATA="$(curl -silent http://api.justin.tv/api/broadcast/by_archive/$ID.xml?onsite=true)" | |
URLs="$(echo $DATA | grep -io 'http.*\.flv')" | |
NAME="$(echo $DATA | grep '<title>' | head -n1 | sed 's/<title>//g' | sed 's/<\/title>//g' | sed 's/^ *//g' | sed 's/ /\./g'| sed 's/\///g'|sed s/\'//g)" | |
mkdir "$NAME" | |
cd "$NAME" | |
COUNTER=1 | |
while read -r line; do | |
axel -a -n20 "$line" | |
filename="$(basename $line)" | |
mv "$filename" "$NAME.-.Part.$COUNTER".flv | |
let COUNTER=COUNTER+1 | |
done <<< "$URLs" | |
for f in ./*.flv; do echo "file '$f'" >> file.list; done | |
ffmpeg -f concat -i file.list -c copy "$NAME.m4v" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment