diff options
| author | Antti Ajanki <antti.ajanki@iki.fi> | 2013-04-13 13:26:56 +0300 |
|---|---|---|
| committer | Antti Ajanki <antti.ajanki@iki.fi> | 2013-04-14 18:58:27 +0300 |
| commit | 5c52f40217d467beec4b2d891c08194593bd9489 (patch) | |
| tree | 5f20db8297a787b504c486f51ca349d9cb9cdd0b /templates/bin | |
| parent | eaf81f840a08fb991f024ebdbe9368bbd1a488ad (diff) | |
| download | vdr-plugin-webvideo-5c52f40217d467beec4b2d891c08194593bd9489.tar.gz vdr-plugin-webvideo-5c52f40217d467beec4b2d891c08194593bd9489.tar.bz2 | |
Fix Katsomo by downloading from the mobile site
Not all streams work
Diffstat (limited to 'templates/bin')
| -rwxr-xr-x | templates/bin/katsomo-dl | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/templates/bin/katsomo-dl b/templates/bin/katsomo-dl new file mode 100755 index 0000000..73d39ab --- /dev/null +++ b/templates/bin/katsomo-dl @@ -0,0 +1,42 @@ +#!/bin/sh + +# Downloads a video from katsomo.fi. The first parameter is the stream +# URL, the optional second parameter is the output file. +# +# Because the main stream is Silverlight, which can't be downloaded, +# get the mobile stream. + +if [ "x$1" = "x" ]; then + echo "Expected URL missing" 1>&2 + exit 1 +fi + +OUTPUT_FILE="$2" +if [ "x$OUTPUT_FILE" = "x" ]; then + OUTPUT_FILE="-" +fi + +# Convert http://www.katsomo.fi/?progId=xxx URL into mobile site URL +# and parse the stream URL from the HTML. + +MOBILE_PAGE=`echo ${1} | sed "s/www/m/"` +STREAM_URL=`curl -A iPhone -L --max-redirs 10 $MOBILE_PAGE 2>/dev/null | grep "video\/mp4" | sed "s/<.*src=\"//" | sed "s/\"\/>//" | sed "s/^ *//g"` + +if [ "x$STREAM_URL" = "x" ]; then + echo "Failed to find the stream URL in $MOBILE_PAGE" 1>&2 + exit 1 +fi + +# The STREAM_URL points to an m3u playlist, using avconv to download +# the stream. + +if [ "x$OUTPUT_FILE" = "x-" -o -p "$OUTPUT_FILE" ]; then + # Transcode into a streamable format + avconv -y -i "$STREAM_URL" -f flv -vcodec libx264 -acodec libmp3lame -ab 192k -ar 22050 "$OUTPUT_FILE" +else + # Would use -acodec copy, but due to a bug avconv sometimes fails + # with a non-monotonic timestamp error. + avconv -y -i "$STREAM_URL" -vcodec copy -acodec mp2 -ab 128k "$OUTPUT_FILE" +fi + +exit $? |
