Skip to content

Instantly share code, notes, and snippets.

@aerith
Created July 17, 2009 06:31
Show Gist options
  • Save aerith/148922 to your computer and use it in GitHub Desktop.
Save aerith/148922 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/perl --
use strict;
use warnings;
use JSON::Syck;
use LWP::UserAgent;
my $agent = LWP::UserAgent->new;
my $a = shift or die;
my $b = shift or die;
my $c = $agent->get(sprintf qq#http://twitter.com/users/show/%s.json#, $a);
my $d = $agent->get(sprintf qq#http://twitter.com/users/show/%s.json#, $b);
if ( $c->is_success and $d->is_success ) {
my $e = JSON::Syck::Load($c->content);
my $f = JSON::Syck::Load($d->content);
die if $e->{protected} or $f->{protected};
my $g = $agent->get(sprintf qq#http://twitter.com/friends/ids/%s.json#, $f->{screen_name});
my @h = @{ JSON::Syck::Load($g->content) };
if ( grep { int $e->{id} == int $_ } @h ) {
printf qq#%s is followed by %s\n#, $e->{screen_name}, $f->{screen_name};
}
}
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment