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:

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):

# 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/

        local progname=${0##*/}

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

    $progname <arte+7 url>


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

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

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

# 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

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

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

./arte.sh “URL”

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

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.

  2 Responses to “Downloading Arte +7 videos takes only one command in Linux”

  1. Can this way to downloading mp4 be used for DVD-run Linux-to-go (DSL & Co) as well ?
    or is it necessary to have an installed Linux with all its weaknesses comparable to ms windows ?

    if the information of this page is not useable for DSL & Co, is there any other way to downloading as mp4 in the context of DVD-run Linux-to-go ? (online interface?)

    the latter question appears because we found an online webcrawler — it seems that everything can be brought to work in an online environment, too — so maybe there is a “flash/shockwave/… (orf.at has awfully changing new arbitrary formats every couple of months) online converter” as well ?
    (the online web crawler was a never ending story, however, and it ran several days nonstop before we shut it down)

    would be great to hear from you


    • Foreword: I am not sure, if this code still works (it is nearly 2 years old). Arte changed the website during that time.

      To your questions: Yes, it should run on Linux Live Distributions, for example Ubuntu, which uses the same commands as I used here. All you need is rtmpdump and some basic Unix/Linux commands like wget/sed/cut/grep.

      But looking at todays Arte +7 library you will need to change the code, here is a manual example:
      – Go to the video you would like to watch (e.g. http://www.arte.tv/guide/de/048561-011/reisen-fuer-geniesser#details-videos) (- Btw, Porto is a great city)
      – In the page source, look for arte_vp_url, it will look like this:
      <div class="video-container" arte_vp_config="arte_tvguide" arte_vp_lang="de_DE" arte_vp_url="http://arte.tv/papi/tvguide/videos/stream/player/D/048561-011_PLUS7-D/ALL/ALL.json"></div>
      – When you open the .json from the arte_vp_url link, you will see all the Video links as JSON. If you find it unreadable, try a JSON parser, e.g. http://json.parser.online.fr/
      The video links starting with rtmp:// will need rtmpdump. The other – in my example http://artestrsmv.rd.llnwd.net/o35/nogeo/videothek/048561-011-A_HQ_1_VA-STA_00732879_MP4-1500_AMM-Reach.mp4 – can be downloaded by wget and other application, they are just plain HTTP.

      I hope that helps. If I find some spare time, I will update the script!

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>