I threw this together quickly for my wife after she read today's NYTimes article on the lander's use of Twitter. We're not cool enough to actually do Twitter, so this is an easy way to get her some recent messages. (Sure, she could just add the RSS feed itself to a browser or aggregator, but that wouldn't be using Perl, now would it?)
At the moment, the script is pretty minimal, but it would be easy to format more from here for inclusion in an email, etc. Check it out if you're curious.
#!/usr/bin/perl use strict; use warnings; use XML::RSS::Parser::Lite; use LWP::Simple; my $xml = get( "http://twitter.com/statuses/user_timeline/14693823.rss" ); die "No connection to MarsPhoenix. Try later.\n" unless defined $xml; my $rss = new XML::RSS::Parser::Lite; $rss->parse( $xml ); print $rss->get( 'title' ) . " - Last ten updates from MarsPhoenix:\n" +; foreach my $number ( 0..9 ) { my $item = $rss->get( $number++ ); print $item->get( 'title' ) . "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Get updates from MarsPhoenix via Twitter & Perl
by blazar (Canon) on Jun 02, 2008 at 14:12 UTC | |
by telemachus (Friar) on Jun 02, 2008 at 22:21 UTC |