Return to Snippet

Revision: 2037
at December 20, 2006 10:34 by rduv


Initial Code
Netlix perl script

# Jared Evans -10/17/04
# http://jarednevans.livejournal.com
# Parse Your Netflix Queue RSS output into a text file

use strict;
use XML::RSSLite;
use LWP::Simple;
use CGI;

# create a CGI output
my $cgi = new CGI;

# Declare variables for URL to be parsed
my $url2parse;
# Setup argument to your Netflix RSS
my $arg = "http://rss.netflix.com/QueueRSS?id=PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
# Get the URL, assign it to url2parse, and then parse the RSS content
$url2parse = get($arg);
die "Could not retrieve $arg" unless $url2parse;

my %result;
my $item;

# Process the RSS and save it in easily accessible variables
parseRSS(\%result, \$url2parse);

# Generate a list of only the first 10 movies in the queue
my $count = 0;
my $max_count = 10;

foreach $item (@{$result{'item'}}) {
     next unless defined($item->{'title'}) &&
defined($item->{'link'}) && ($count < $max_count);
     print "<li><a href=\"$item->{'link'}\">$item->{'title'}</a><BR>\n";
     $count = $count + 1 ;
}

Initial URL


Initial Description


Initial Title
netflix queue perlscript

Initial Tags


Initial Language
Perl