#!/usr/bin/perl use XML::RSS; use LJ::Simple; use LWP::Simple; use strict; # load the RSS feed my $rss = XML::RSS->new; my $feed = "http://del.icio.us/rss/jmartenstein"; my $content = get($feed); $rss->parse($content); # set the limit for how many links to display my $display_count = 5; my @items_list = @{$rss->{items}}; my $list_count = $#items_list; # make sure that there are at least 5 items in the list if ($list_count < $display_count) { $display_count = $list_count; } my $entries_list = ""; # scan the list of items, print the relevant information for (my $i=0; $i<$display_count; $i++) { my $item = $items_list[$i]; my $entry = ""; $entry .= " $item->{'title'}\n"; if ($item->{'description'} ne "") { $entry .= " $item->{'description'}\n"; } $entry .= " link\n"; $entry .= "\n"; $entries_list .= $entry; } my $ario_link = "http://interimlover.livejournal.com/398221.html"; my $script_link = "http://vorlon.eecs.cwru.edu/~jtm5/lj_rss.txt"; my $delicious_link = "http://del.icio.us/jmartenstein"; my $post = ""; $post .= "This is an automatically generated post to address Ario's RSS to Livejournal dilemma. I grabbed the last " . "five links from my del.icio.us account " . "through the RSS feed and then posted using the Livejournal API. " . "You can check out the source for the script over here.\n\n"; $post .= $entries_list; LJ::Simple::QuickPost( user => "jmartenstein", pass => "$ARGV[0]", entry => "$html", subject => "del.icio.us -> LiveJournal", ) || die "$0: Failed to post entry: $LJ::Simple::error\n"; #print $post;