Created
July 17, 2009 06:31
-
-
Save aerith/148922 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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