-
-
Save arian/1339537 to your computer and use it in GitHub Desktop.
#!/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 |
My Debian install (on a VirtualMachine) does not recognize xpath. I haven't been able to find a package to install it, any thoughts?
@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?
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).
For this you need Linux or a Mac.
Then save this to a file, open the command line, chmod the file:
And then copy the ID from the collegerama URL, so for example from
you select
And then you can execute this script