#!/usr/local/bin/perl # arte_rtmpdump.pl # - Simple script do simplify arte mediathek downloads # - by Stefan `Sec` Zehl # - Licence: BSD (2-clause) # example URL: # - http://videos.arte.tv/de/videos/flaschenwahn_statt_wasserhahn-3775760.html'; $_=$ARGV[0]; use warnings; use strict; use GET; GET::config ( min_cache => 3000, ); my $body; my $err; $body=GET::get_url($_); if (!($body=~/url_player\s*=\s*"([^"]*)/s)){ die "Can't find player URL\n"; }; my $player=$1; if(!($body=~/new(); my $doc = $parser->parse_string($body); my $url=${ $doc->findnodes('//*/video[@lang="de"]/@ref') }[0] -> textContent; if(!$url){ die "Couldn't find second xml url\n"; }; $body=GET::get_url($url); if(!$body){ die "No content?"; }; #print $body; my $doc2 = $parser->parse_string($body); my $name= ${ $doc2->findnodes('/video/name') }[0] -> textContent; print "Video name: $name\n"; $name=~s! !_!g; $name=~y!a-zA-Z_!!cd; $name="ARTE-".$name.".flv"; my $url2=${ $doc2->findnodes('//*/url[@quality="hd"]') }[0] -> textContent; #print $url2,"\n"; if (!($url2=~ m!(rtmp)://([^/]*)/(.*)/(MP4:.*)!)){ die "Can't match URL: $url2\n"; }; my ($proto,$host,$app,$path)=($1,$2,$3,$4); print <