20120611 getvodcasts pl - plembo/onemoretech GitHub Wiki

title: getvodcasts.pl link: https://onemoretech.wordpress.com/2012/06/11/getvodcasts-pl/ author: lembobro description: post_id: 2856 created: 2012/06/11 22:00:21 created_gmt: 2012/06/12 02:00:21 comment_status: closed post_name: getvodcasts-pl status: publish post_type: post

getvodcasts.pl

Just a simple perl script to cycle through a list of rss feeds and pump out any media urls contained in the "enclosure element" of each item. Here's the basic code. I've also written a cgi version that prints the urls as hyperlinks (I'll post that as soon as its been polished a bit more). The heart of this script is the XML::FeedPP module.

#!/usr/bin/perl

use XML::FeedPP;

my @sources = (
 'http://www.cbsnews.com/common/includes/podcast/podcast_eveningnews_video_1.rss',
 'http://podcastfeeds.nbcnews.com/audio/podcast/MSNBC-NN-NETCAST-M4V.xml',
 'http://www.nasa.gov/rss/TWAN_vodcast.rss',

);

foreach my $source(@sources) {

  my $feed = XML::FeedPP->new($source);
  my $title = $feed->title();
  print $title, "n";
  foreach my $item ( $feed->get_item() ) {
     my $medialink = $item->get('enclosure@url');
     my $pubdate = $item->pubDate();
     print $pubdate, "n";
     print $medialink, "n";
  }
  print "n";
}
__END__;

Output looks like this:

NBC Nightly News (video)
2012-06-11T17:03:11-08:00
http://msnbcpod.vo.llnwd.net/l1/video/podcast/pdv_nn_netcast_m4v-06-11-2012-170036.m4v

One thing I'd like to do with this is find a way to automate creating external link objects in mediatomb, the upnp media server software I run at home. All I need now is an example of how to create such an object via mediatomb's javascript api.

Copyright 2004-2019 Phil Lembo