Mirzad

Jan 252012
 

Update (10.10.2013):
The old script is no longer working (for historic reasons I’ve put it at the end of the site). A quick and dirty workaround is this bash script:

#!/bin/bash
wget $1 -O tmp1 && grep .json tmp1 | grep PLUS7 | uniq | cut -d"=" -f5 | cut -d"\"" -f2 | xargs -i wget {} -O tmp2 && sed -i "s/}/}\r\n/g" tmp2 && grep mp4 tmp2 | grep -v rtmp | sed "s/,/,\r\n/g" | egrep "Libelle|url"
rm -fr tmp1
rm -fr tmp2

which will display you the French and German links to the video. You can wget it then.

The better (and 720p) version uses rtmpdump. I found this code to work (credits in the code):

#!/bin/bash
#
# Arte+7 video downloader (french HD version)
# mod to download German HD version
# Author: Gerome Fournier
# Version: 0.3
# Date: 2013-09-15
# http://foutaise.org/code/

usage()
{
        local progname=${0##*/}

        cat <<EOF
Dump French HD version of a arte+7 video
Usage:

    $progname <arte+7 url>

Example:

    $progname "http://www.arte.tv/guide/fr/047158-000/evasion-fiscale?autoplay=1" > evasion-fiscale.flv
EOF
}

if [ "$1" == "-h" ]; then
        usage
        exit 0
fi

if [ "$#" -ne 1 ]; then
        echo "Wrong number of arguments" >&2
        usage
        exit 1
fi

# walk through several URLs to find the stream
link1=$(curl -s "$1" \
        | grep ALL.json \
        | head -n1 \
        | sed -e 's/^.*arte_vp_url="//' -e 's/".*$//')
if [ -n "$link1" ]; then
        json_hd_french=$(curl -s "$link1" | tr '{' '\n' | grep '"quality":"HD - 720p".*"versionCode":"\(VF\|VF-STF\|VOF-STF\)"' | tr ',' '\n')
        json_hd_german=$(curl -s "$link1" | tr '{' '\n' | grep '"quality":"HD - 720p".*"versionCode":"\(VA-STA\)"' | tr ',' '\n')
        streamer=$(grep '^"streamer"' <<< "$json_hd_german" | cut -d: -f2- | tr -d '"')
        url=$(grep '^"url"' <<< "$json_hd_german" | cut -d: -f2- | tr -d '"')
        if [ "${streamer:0:7}" == "rtmp://" ]; then
                echo $streamer
                echo $url
                rtmpdump -r "$streamer" -y "mp4:$url"
                exit 0
        fi
fi

echo "Unable to find source stream" >&2
exit 1

Depending on your prefered language, you may just take it (it will download in french) or change it to German (“VA-STA” instead of “VF\|VF-STF\|VOF-STF\”).

This was the old code, just for historic reasons, it is no longer working:

root gaia:/tmp# cat arte.sh

#!/bin/bash
wget -c $1 -O tmp0 ; grep CasPlayerXml.xml tmp0 | sed "s/%2F/\//g" | cut -d"=" -f11 | grep videos | sed "s/\"//g" | sed "s/%7B/:/g" | sed "s/%3A/:/g" | xargs wget {} -O tmp1 ; grep "asPlayerXml" tmp1 | grep "/de/" | cut -d" " -f3 | cut -d"\"" -f2 | xargs wget {} -O tmp2 ; cat tmp2 | grep rtmp | grep hd | cut -d">" -f2 | cut -d"<" -f1 | xargs -i rtmpdump -r {} -o out.mp4 ; rm tmp0 && rm tmp1 && rm tmp2 && exit 0

Usage:
./arte.sh “URL”

Example:
./arte.sh “http://videos.arte.tv/de/videos/belle_france_3_10_-6327808.html”

Output:
Files will be saved in German (grep “/de/”), High quality (grep hd) as “out.mp4”.

You need rtmpdump (apt-get install rtmpdump or git clone it from the website). Feel free to edit it to your needs.