Требуется wget и rtmpdump.
#!/bin/sh
# This file name: rutube-dl
# Version: 0.2
# License: WTFPL version 2
# Author: Alexey Alexeev aam.neo@gmail.com
if test "$1" == '--help' || test "$#" -eq 0 || test "$#" -gt 3; then
echo 'Usage: rutube-dl [-c] URL [OUTPUT_FILE]'
exit 0
fi
if test "$1" == '-c'; then
url=$2
output_file=$3
option_resume=1
else
url=$1
output_file=$2
fi
echo 'Obtaining file name:'
video_id=`echo "$url" | sed 's/^.*=//'`
video_url=`wget -O - http://bl.rutube.ru/$video_id.xml | grep CDATA | sed 's/^.*CDATA\[//;s/\]\]>.*$//'`
if test "$video_url" == 'http://rutube.ru/not_found.iflv'; then
echo 'rutube-dl: video not found' 1>&2
exit 1
fi
if test -n "$output_file"; then
output_file_name=$output_file.flv
else
output_file_name=$video_id.flv
fi
echo "Obtaining file $output_file_name:"
protocol=${video_url%%:*}
case "$protocol" in
http)
if test "$option_resume" -eq 1; then
options=-c
fi
wget -O "$output_file_name" $options "$video_url"
;;
rtmp)
if test "$option_resume" -eq 1; then
options=-e
fi
playpath=`echo $video_url | grep -o mp4:.*\.mp4`
if ! test -z "$playpath"; then
options="$options -y $playpath"
fi
rtmpdump -o "$output_file_name" -r "$video_url" $options -s http://rutube.ru/player.swf
;;
*) echo 'rutube-dl: unsupported protocol' 1>&2; exit 1;;
esac