Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Twitter Reader

by wizbancp (Sexton)
on Feb 12, 2007 at 09:03 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: sourcecode [id://599520]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-04-16 18:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found