Created
March 27, 2012 18:47
-
-
Save walkure/2219063 to your computer and use it in GitHub Desktop.
find the oldest user in KMC(Kyoto univ. Microcomputer Club) member list
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/bin/env perl | |
use strict; | |
use warnings; | |
use Date::Parse; | |
use Net::Twitter::Lite; | |
my $nt = Net::Twitter::Lite->new( | |
consumer_key => 'consumer key', | |
consumer_secret => 'consumer secret', | |
); | |
$nt->access_token ('access token'); | |
$nt->access_token_secret('access secret'); | |
my @members; | |
my $cursor = '-1'; | |
while($cursor ne '0'){ | |
my $aref = $nt->list_members({cursor => $cursor , user=>'seikichi' , list_id => 'kmc'}); | |
$cursor = $aref->{next_cursor}; | |
push(@members,@{$aref->{users}}); | |
} | |
my %ulist; | |
foreach my $user(@members){ | |
$ulist{str2time($user->{created_at})} = $user->{screen_name}; | |
} | |
foreach my $d (reverse sort keys %ulist){ | |
print $ulist{$d}.':'.localtime($d)."\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment