Last active
June 5, 2017 21:05
-
-
Save arian/1339537 to your computer and use it in GitHub Desktop.
Download TU Delft Collegerama video streams, Silverlight player sucks.
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
#!/bin/bash | |
slides=1; | |
video=1; | |
for var in "$@" | |
do | |
if [ "${var}" = "--slidesOnly" ]; then | |
video=0; | |
slides=1; | |
continue; | |
fi | |
if [ "${var}" = "--videoOnly" ]; then | |
video=1; | |
slides=0; | |
continue; | |
fi | |
done | |
if [ -z $1 ]; then | |
echo " | |
./collegedownloader <id> [filename] | |
id: College peid url query variable (?peid=<id>) | |
filename: Filename to save to | |
" | |
exit; | |
fi | |
id=$1 | |
file="${id:0:8}-${id:8:4}-${id:12:4}-${id:16:4}-${id:20:12}" | |
manifest="http://collegerama.tudelft.nl/Mediasite/FileServer/Presentation/${id}/manifest.xml"; | |
manifest_xml=`wget ${manifest} --quiet -O -`; | |
# video | |
if [ $video -eq 1 ]; then | |
mp4=`echo "${manifest_xml}" | xpath -q -e '//VideoContent/Location/text()'` | |
wget "${mp4}" -O $2 | |
fi | |
# slides | |
if [ $slides -eq 1 ]; then | |
slides=`echo "${manifest_xml}" | xpath -q -e '//Slide/Time/text()'` | |
dataUrl=`echo "${manifest_xml}" | xpath -q -e '//SlideDataUrl/text()'` | |
i=1; | |
url="http://collegerama.tudelft.nl${dataUrl}/Presentation/${file}/slide_" | |
for slide in $slides | |
do | |
c=`printf "%04d" "${i}"`; | |
slide_url="${url}${c}_1024_768.jpg"; | |
file="slide_${c}_${slide}.jpg"; | |
echo "${file}"; | |
wget "${slide_url}" -q -O "${file}"; | |
i=$((i+1)); | |
done | |
fi |
They replaced the manifest file with an extremely overengineered JSON API, but the process of looking up and downloading videos is still basically the same. Here's the script I'm using: https://gist.github.com/mnstrspeed/327e1a43ac09e67829b0. It depends on jq
instead of xpath
, so make sure that's installed (sudo apt-get install jq
in Ubuntu/Debian).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@IJoshFTW, in Ubuntu the package that supplies the xpath executable is called
libxml-xpath-perl
. It might be the same in Debian.This way of downloading content from collegerama does not seem to work anymore, as the manifest file is not at the expected location anymore. Does anyone know how to work around this problem?