Revision: 22440
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 12, 2010 15:56 by prwood
Initial Code
#!/usr/local/bin/perl use strict; use Net::Twitter; use Getopt::Std; my %options = (); getopts('u:p:',\%options); my $twitter = Net::Twitter->new( username => $options{u}, password => $options{p}, ); if ( ! $options{u} || ! $options{p} ) { die "Usage: ./twitter_client_report.pl -u <twitter username> -p <twitter password>"; } my $verification = $twitter->verify_credentials(); my %clients = (); my $friends = $twitter->friends(); foreach my $friend ( @{$friends} ) { $clients{$friend->{'status'}->{'source'}}++; } foreach my $client ( sort { $clients{$a} <=> $clients{$b} } keys( %clients ) ) { print $clients{$client} . " - $client\n"; }
Initial URL
Initial Description
This report looks at the most recent Tweet from each person in your friends list and keeps track of which client they're using. It then prints out a report showing how many people use each client, with the most popular at the bottom. Code is written to be run via the command line, but could be adapted to other uses. Requires Net::Twitter, which is available via CPAN.
Initial Title
Twitter Client Report
Initial Tags
Initial Language
Perl