Posted By

rduv on 12/20/06


Tagged

netflix


Versions (?)

netflix queue perlscript


 / Published in: Perl
 

  1. Netlix perl script
  2.  
  3. # Jared Evans -10/17/04
  4. # http://jarednevans.livejournal.com
  5. # Parse Your Netflix Queue RSS output into a text file
  6.  
  7. use strict;
  8. use XML::RSSLite;
  9. use LWP::Simple;
  10. use CGI;
  11.  
  12. # create a CGI output
  13. my $cgi = new CGI;
  14.  
  15. # Declare variables for URL to be parsed
  16. my $url2parse;
  17. # Setup argument to your Netflix RSS
  18. my $arg = "http://rss.netflix.com/QueueRSS?id=PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  19. # Get the URL, assign it to url2parse, and then parse the RSS content
  20. $url2parse = get($arg);
  21. die "Could not retrieve $arg" unless $url2parse;
  22.  
  23. my %result;
  24. my $item;
  25.  
  26. # Process the RSS and save it in easily accessible variables
  27. parseRSS(\%result, \$url2parse);
  28.  
  29. # Generate a list of only the first 10 movies in the queue
  30. my $count = 0;
  31. my $max_count = 10;
  32.  
  33. foreach $item (@{$result{'item'}}) {
  34. next unless defined($item->{'title'}) &&
  35. defined($item->{'link'}) && ($count < $max_count);
  36. print "<li><a href=\"$item->{'link'}\">$item->{'title'}</a><BR>\n";
  37. $count = $count + 1 ;
  38. }

Report this snippet  

You need to login to post a comment.