Friendly Followers and Followings of Friends on Twitter

Jay Gold wrote a good blog entry entitled ‘Follow Back: How I Choose Who to Follow on Twitter’.

Jay has some really good points and a nice strategy for his tweeteria.

I am not a big fan of the whole follow me and I follow you back. You might not find my tweets interesting even though I find yours. This has a side effect that I always have more followers than friends, simply because I cannot control how many people choose to follow me and I only add people whom I would like to follow, since their tweets are of interest to me – well that and I am a lazy bastard.

Web Upd8 had an article on ReFollow.com an online service to manage your Twitter friends and followers. The service helps you to get a nice picture of your friends and followers and who are both friends and followers.

Anyway, due to my lazy attitude I actually wrote up a Perl application prior to trying out ReFollow.com. So here it is if you are interested. The application show you your friends, followers and people in both groups, so you can easily identify people whom you follow, but you do not follow and vice versa.

  1. #!/usr/bin/perl
  2. # $Id$
  3. use strict;
  4. use warnings;
  5. use Getopt::Long;
  6. use Pod::Usage;
  7. use Net::Twitter::Lite;
  8. use List::MoreUtils qw(any);
  9. use English qw( -no_match_vars );
  10. my $username;
  11. my $password;
  12. GetOptions( 'username=s' => \$username, 'password=s' => \$password );
  13. if ( not $username ) {
  14. pod2usage(1);
  15. }
  16. if ( not $password ) {
  17. print "Please provide password: ";
  18. $password = <STDIN>;
  19. chomp $password;
  20. }
  21. my $nt = Net::Twitter::Lite->new(
  22. username => $username,
  23. password => $password,
  24. );
  25. my $friends_list = $nt->friends();
  26. my $followers_list = $nt->followers();
  27. $friends_list = $nt->friends();
  28. $followers_list = $nt->followers();
  29. };
  30. if ($EVAL_ERROR) {
  31. die “Unable to connect to twitter - $EVAL_ERROR;
  32. }
  33. my @friends = map { $_->{screen_name} } @{$friends_list};
  34. my @friends_and_followers;
  35. my @followers;
  36. my $i = 0;
  37. for my $follower ( @{$followers_list} ) {
  38. if ( any { $_ eq $follower->{screen_name} } @friends ) {
  39. push @friends_and_followers, $follower->{screen_name};
  40. }
  41. push @followers, $follower->{screen_name};
  42. $i++;
  43. }
  44. print “Friends and Followers (. scalar @friends_and_followers .):\n;
  45. print join,, @friends_and_followers;
  46. print\n\nFriends (. scalar @friends .):\n;
  47. print join,, @friends;
  48. print\n\nFollowers (. scalar @followers .):\n;
  49. print join,, @followers;
  50. print\n;
  51. exit 0;
  52. __END__
  53. =pod
  54. =head1 NAME
  55. twitter.pl - CLI twitter client
  56. =head1 SYNOPSIS
  57.   twitter.pl [options]
  58.   Options:
  59.   --username <username>
  60.   --password <password>
  61. =head1 OPTIONS
  62. =over 8
  63. =item B<--username> Twitter username, this parameter is mandatory
  64. =item B<--password> Twitter password, this parameter is optional, if not provided you will be prompted for a password.
  65. =back
Leave a comment

2 Comments.

  1. Thanks for linking to my post on following! Glad you liked it. I’ve changed my strategy a little since then, but it’s still basically the same thing. I would probably put a little more stress on carefully choosing your avatar (so it stands out among the stream) and making sure you have an up to date bio that actually says who you are and what you do.

    Not on a machine where I can try out the PERL script right now but will give it a shot when I am. Looks interesting!

  2. Well it is hard to stand out, but I will give it a try and to update my blog with some more information when I get the TUITS

    jonasbn

Leave a Reply


[ Ctrl + Enter ]