FM4 podcast downloader (update)

As FM4 changed their podcast infrastructure, the old downloader doesn’t work anymore; here is a little update:

#!/usr/bin/perl -w

use strict;
use LWP::Simple;
use JSON;

my $json = JSON->new;
my $prefix = "http://loopstream01.apa.at/?channel=fm4&ua=ipad&id=";

my $urls = [
        "http://audioapi.orf.at/fm4/json/2.0/playlist/4ULMon", 
        "http://audioapi.orf.at/fm4/json/2.0/playlist/4ULTue",
        "http://audioapi.orf.at/fm4/json/2.0/playlist/4ULWed",
        "http://audioapi.orf.at/fm4/json/2.0/playlist/4ULThu",
        "http://audioapi.orf.at/fm4/json/2.0/playlist/4ULFri",
        ];


foreach my $url (values $urls) {
        my $content = get $url or next;

        my $data = $json->decode($content);

        my $filename = $data->{"streams"}[0]->{'loopStreamId'};
        my $mp3 = $prefix.$filename;
        print $mp3." -> ".$filename."\n";
        getstore ($mp3, $filename);
}

Now they use json instead of xml and it’s not possible to continue a download anymore.

Leave a comment