Tag Archives: perl

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.

FM4 podcast downloader

Same entry as in my old spin blog.

Downloads fm4 unlimited and fm4 soundpark from http://fm4.orf.at/podcast using

  • LWP::Simple
  • XML::Simple

 

#!/usr/bin/perl -w

use strict;
use LWP::Simple;
use XML::Simple qw(:strict);

my $xmlinformation = ["http://onapp1.orf.at/webcam/fm4/fod/unlimited.xspf",
                     "http://onapp1.orf.at/webcam/fm4/fod/soundpark.xspf"];

foreach my $url (values $xmlinformation) {
        print "- ".$url."\n";
        my $content = get $url;

        #print $content;

        my $xs = XML::Simple->new();
        my $xml = $xs->XMLin($content, KeyAttr => {}, ForceArray => [
                  'location']);

        #print Dumper($xml)."\n\n";
        print $xml->{title}."\n";

        foreach my $track (values $xml->{trackList}->{track}) {
                my $url = $track->{location}->[0];
                my $filename = $1 if ($url =~ m/.*\/+(.*)/g);
                print $url." > $filename"."\n-----------------\n";
                mirror ($url, $filename);
        }
}