Last active
February 11, 2017 23:28
-
-
Save reox/c3dc1a8873fa3bdfb7f9 to your computer and use it in GitHub Desktop.
Download Alpha Centauri Episodes
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
# first get all xml files with the download link | |
for url in $(curl http://www.br.de/fernsehen/ard-alpha/sendungen/alpha-centauri/alle-videos/index.html | egrep -o 'href="(.*[^"])" .* title="zur Übersicht' | awk -F "\"" '{ print $2 }'); do | |
for videourl in $(curl http://www.br.de/$url | egrep -o 'href="(.*[^"])" .* title="zum Video' | awk -F "\"" '{ print $2 }'); do | |
xmlfile=$(curl http://www.br.de/$videourl | egrep -o "dataUrl:'(.*[^'])'" | awk -F "'" '{ print $2 }') | |
wget http://www.br.de/$xmlfile | |
done | |
done | |
# second get the actual file | |
for file in *.xml; do | |
title=$(xpath -e './/title/text()' $file) | |
url=$(xpath -e './/asset[@type="PREMIUM"]/downloadUrl/text()' $file) | |
wget -c "$url" -O "$title.mp4" | |
done | |
# you could merge step one and two if you like... | |
# convert wrong encoding in filenames: | |
convmv -f ISO-8859-1 -t UTF-8 --notest *.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment