Skip to content

Instantly share code, notes, and snippets.

@klausenbusk klausenbusk/drnuget Secret
Last active Dec 14, 2015

What would you like to do?
Bash script to download "programs" (video) from (using api)
slug=$(echo "$1" | cut -f7 -d /)
programcard=$(curl --silent"$slug")
function byte()
local byteoffset=$(echo ${!2} | grep -o --byte-offset "\"$1\":" | cut -f1 -d : | head -n 1)
echo ${!2} | cut -b $(($byteoffset+$(echo $1 | wc -c)))- | cut -f3 -d \" | head -n 1
Title=$(byte "Title" 'programcard' | sed "s/\( \?- \?\|: \| \|:\)/-/g")
BroadcastDate=$(byte "BroadcastDate" 'programcard')
VideoResource=$(byte "VideoResource\",\"Uri" 'programcard')
VideoResource=$(curl --silent --location "$VideoResource")
url=$(echo $VideoResource | grep -o '[0-9a-zA-Z/.,_-:]*.m3u8')
url=$(curl --silent $url | grep -v \# | head -n1)
for file in $(curl --silent $url | grep -v \#);
curl "$file" >> "$Title-$(date +%d-%b-%Y --date=$BroadcastDate).mp4"

This comment has been minimized.

Copy link
Owner Author

commented Apr 2, 2013

We need to look at bitrate... (VideoResource)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.