Hack2.Rebroadcast Your Favorite Feeds


Hack 2. Rebroadcast Your Favorite Feeds

Combine a bunch of feeds to make your own broadcast network.

Podcasting is like TiVo: you set up your subscriptions and get the shows you want as they come out. But what happens when you want to take your subscriptions on the road, or share them with your friends? This script allows you to create a single feed that pulls the most recent podcast from each feed you specify.

1.3.1. The Code

Save the following code as network.pl:

 #!/usr/bin/perl -w use LWP::Simple; use strict; # The list of feeds to retrieve my @feeds = qw(  http://www.curry.com/xml/rss.xml  http://www.boundcast.com/index.xml ); # The title of the network feed my $networkName = "My Network"; # The URL of the home page my $url = "http://www.mysite.com"; # A description of your network my $description = "My very own network";   # Format the current date and time my @days = qw( Sun Mon Tue Wed Thu Fri Sat ); my @months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); my @t = gmtime( time ); my $date = sprintf( "%s, %d %s %d %02d:%02d:%02d GMT", $days[ $t[6] ], $t[3], $months[ $t[4] ], $t[5] + 1900, $t[2], $t[1], $t[0] ); # Print the header portion of the RSS 2.0 print <<END; Content-type: text/xml <?xml version="1.0"?> <rss version="2.0"> <channel> <title>$networkName</title> <link>$url</link> <description>$description</description> <language>en-us</language> <pubDate>$date</pubDate> <lastBuildDate>$date</lastBuildDate> <generator>Network 1.0</generator> END # Iterate through each feed and find the first # item with an enclosure then print it out foreach my $feed ( @feeds ) {  my $data = get $feed;  while( $data =~ /(<item>.*?<\/item>)/sg ) {  my $item = $1;  if ( $item =~ /<enclosure/ )  {   print $item;   last;   }  } } # Print the footer print <<END; </channel> </rss> END 

This script will read the RSS from the feeds you specify in the @feeds array. Then it will combine all the feeds into a new, single RSS 2.0 feed with the name, description, and URL that you specify. Modify the variables at the top of the script before you upload it to your web server.

1.3.2. Running the Hack

To put the feed on the network so that it's visible from anywhere, you will need to upload the script to your ISP. The ISP needs to support Perl scripts and have the LWP::Simple library. You can use the script locally on Mac OS X by placing this script in your /Library/WebServer/CGI-Executable directory. On Windows, you will need to install ActiveState Perl first. Then copy the network.pl script into your server's document directory [Hack #7].

1.3.3. Build a "Best of" Feed

Turning people on to podcasting can be difficult. The show that was great last week could be only so-so this week and could turn them off from the start. To make sure people have a great first experience with podcasting you can create your own "best of" feed with the free GigaDial service (http://www.gigadial.net/).

Start by creating an account with the service. Then create your own custom feed. From there you can add your favorite episodes to the custom feed. With a link to your feed and a copy of iPodder, your friends should have a great introduction to podcasting.

GigaDial, shown in Figure 1-12, doesn't stop there, though. You and your friends can collaborate on building the perfect feed because they can help maintain the list simply by logging onto the service and adding entries to your feed.

Here are some suggestions on other ways to use GigaDial:


Genre feeds

Create several feeds that relate to a genre or theme and allow others to add recent podcasts into the theme.


Best-of-your-show feed

Create a "best of" feed for your own show.


Short list forPDAs

Create a single custom feed that limits what is sent to your PDA's podcatcher [Hack #8].

If you want to share your feed list with your friends, have a look at Bloglines (http://www.bloglines.com/). At this site, you can not only read blogs and listen to podcasts, but also publish your feeds so that you can easily share them with others.

1.3.4. See Also

  • "Join or Build a Podcast Network" [Hack #49]

Figure 1-12. GigaDial's feed editing page




    Podcasting Hacks
    Podcasting Hacks: Tips and Tools for Blogging Out Loud
    ISBN: 0596100663
    EAN: 2147483647
    Year: 2003
    Pages: 144

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net