Skip to content

Instantly share code, notes, and snippets.

@reox
Last active February 11, 2017 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reox/c3dc1a8873fa3bdfb7f9 to your computer and use it in GitHub Desktop.
Save reox/c3dc1a8873fa3bdfb7f9 to your computer and use it in GitHub Desktop.
Download Alpha Centauri Episodes
# 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