ARD (Video)-Podcast Downloader

Posted on Wed 24 November 2010 in Linux • 1 min read

#!/usr/bin/perl -w
#
# ARD tagesschau podcast url
$url = "http://www.tagesschau.de/export/video-podcast/webl/tagesschau/";
#
# wget parameter
$wgetopts = "--quiet";
$targetpath = "/tmp";
#
# Enable verbose output
$verbose = 0;
#
#############################

use XML::Simple;
use LWP::Simple;

sub output{
        my $msg = shift;
        if ($verbose) { printf STDERR "$msg\n"; }
}

$xmlcontent = get($url);

my $xml = XMLin($xmlcontent);

$title = $xml->{channel}->{item}->[0]->{title};
$url = $xml->{channel}->{item}->[0]->{enclosure}->{url};
$filename = $url;
$filename =~ s/.*\///;

$path = "$targetpath/$filename";

output("Titel:\t$title");
output("URL:\t$url");
output("File:\t$path\n");

if (-e "$path") {
        output("$path exists !");
        exit 1;
} else {
        output("Downloading...");
        system("wget", "-O", $path, $wgetopts, $url);
}

Its not perfect...feel free to send me feedback/patches/changes.