Skip to content

Instantly share code, notes, and snippets.

@boxdot
Last active August 29, 2015 14:06
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 boxdot/64533182527fc4b47719 to your computer and use it in GitHub Desktop.
Save boxdot/64533182527fc4b47719 to your computer and use it in GitHub Desktop.
A simple bash/python script to fetch video urls for Arte Tracks
#!/bin/bash
#
# settings
#
LANGUAGE=DE
#
# script
#
wget "http://www.arte.tv/guide/de/sendungen/TRA/tracks" -q -O tracks.html
VIDEO_ID=`grep "data-vid=" tracks.html | sed -En "s/.*data\-vid\='([^']+)'.*/\1/p" | uniq`
wget "http://arte.tv/papi/tvguide/videos/stream/player/D/$VIDEO_ID/ALL/ALL.json" -q -O video.json
python <<END
import json
with open("video.json") as f:
d = json.load(f)
d = d["videoJsonPlayer"]
print "Date : %s" % d['VDA']
print "Desc (short): %s" % d['V7T']
print "Desc (long) : %s" % d['VDE']
print ""
videos = d["VSR"].values()
for x in filter(lambda x: x["mediaType"] == "mp4" and x["versionShortLibelle"] == '$LANGUAGE', videos):
print "Quality: %s" % x["quality"]
print "Url : %s" % x["url"]
print ""
END
# cleanup
rm -f tracks.html video.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment