-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTwitterStats.pl
More file actions
executable file
·54 lines (43 loc) · 1.22 KB
/
Copy pathTwitterStats.pl
File metadata and controls
executable file
·54 lines (43 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl
#use strict;
use Class::Struct;
use Net::Twitter;
use Term::ReadKey;
struct Friend => {
name => '$',
NbFriends => '$',
NbFollowers => '$',
Friends => '@',
Followers => '@',
};
my @FriendsArray;
print "Please enter your twitter username:\t";
my $username = <STDIN>;
print "Please enter your twitter password:\t";
ReadMode 'raw';
my $passphrase;
while (1) {
my $key .= (ReadKey 0);
if ($key ne "\n") {
print '*';
$passphrase .= $key
} else {
last
}
}
ReadMode 'restore';
my $twit = Net::Twitter->new({username=>$username, password=>$passphrase });
my $friendres = $twit->friends();
foreach $myfriend (@{$friendres}){
$fStruct = Friend->new();
print "Processing: ". $myfriend->{'screen_name'} . "\n";
$fStruct->name($myfriend->{'screen_name'});
$fStruct->NbFriends($myfriend->{'friends_count'});
$fStruct->NbFollowers($myfriend->{'followers_count'});
push(@FriendsArray,$fStruct);
}
foreach(@FriendsArray){
print $_->name() . " has ";
print $_->NbFriends() . " friends and ";
print $_->NbFollowers() . " followers \n";
}