Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Twitter Reader

by wizbancp (Sexton)
on Feb 12, 2007 at 09:03 UTC ( #599520=sourcecode: print w/replies, xml ) Need Help??
Category: Web Stuff
Author/Contact Info wizbancp
Description: Is a code for visualize the last post of you and your friend's on twitter. configurable number of post to read (default 8)
#!/usr/bin/perl -w

require LWP::UserAgent;

#$indirizzorss is your rss address 
$indirizzorss =             "http://twitter.com/statuses/friends_timel
+ine/xxxxxx.rss";
$nummess= 8; #max number of post to show

my $ua = LWP::UserAgent->new;
$ua->agent('WizTwitterBot/1.0');
$ua->timeout(10);
$ua->env_proxy;
 
sub pausa #mette in pausa il programma prima di uscire
{
   print "\nPremi Invio per continuare\n";
   my $pausa = <STDIN>;
} #fine subroutine pausa
  

sub catturaxml
{
    $codice = shift;
    $cont = shift;
  
    while (($codice =~ m/<title>(.*)<\/title>/g)&&($cont>0))
    {
      my $contenuto="$1";
      print "-"x36,"\n";
      print "$contenuto\n";
      $cont--
    }
}


$response = $ua->get("$indirizzorss");

if ($response->is_success)
{   
    $codicexml = $response->content;
    catturaxml($codicexml,$nummess);
    pausa;
}
else
{
    die $response->status_line;
}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://599520]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2019-12-06 15:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (156 votes). Check out past polls.

    Notices?