Hi Again,
If you have seen the your twitter page , you will find the following tab about the user.
As U can can see in the image , there are four important tab
1. tweet (your own tweet)
2. following
3. followers
4. list
In this tutorial I will let you know how to get your following account . You can expand this program further to find the set of people you and your friends may have common.
“Net::Twiiter” has a dedicate function called “followers_ids” list of parameters and then we will pass the individual id to get more detail.
So here is the code.
In the next tutorial , I will try to fetch the twit twitted by the end user following.
If you have seen the your twitter page , you will find the following tab about the user.
As U can can see in the image , there are four important tab
1. tweet (your own tweet)
2. following
3. followers
4. list
In this tutorial I will let you know how to get your following account . You can expand this program further to find the set of people you and your friends may have common.
“Net::Twiiter” has a dedicate function called “followers_ids” list of parameters and then we will pass the individual id to get more detail.
So here is the code.
This file contains hidden or 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/perl | |
use Data::Dumper; | |
use Net::Twitter; | |
##fill in your dev.twitter stuff below | |
my $twitterconsumer = "ur_consumer"; | |
my $twitterconsumersecret = "ur_consumer_secret"; | |
my $twitteraccesstoken = "ur_access_token"; | |
my $twitteraccesstokensecret = "ur_access_token_secret"; | |
my $nt = Net::Twitter->new( | |
traits => [qw/API::RESTv1_1/], | |
consumer_key => $twitterconsumer, | |
consumer_secret => $twitterconsumersecret, | |
access_token => $twitteraccesstoken, | |
access_token_secret => $twitteraccesstokensecret, | |
); | |
if (1) { | |
#fetched the id | |
my $twitterFollowiing = $nt->followers_ids; | |
#now iterating over each id to fetch other details | |
foreach my $id ( @{ $twitterFollowiing->{ids} } ) { | |
my $followers = $nt->followers( {user_id => $id} ) ; | |
foreach my $new_hash ( @{$followers->{users}} ) { | |
#printing the user id, name and his/her acc screen name | |
print $new_hash->{'id'} , " : " , $new_hash->{'name'} , " : " , $new_hash->{'screen_name'},"\n"; | |
} | |
} | |
} | |
else { | |
my $twitterStatus = "Hi I \'m twitting this using Net::Twitter"; | |
$nt->update({ status => $twitterStatus }); | |
} |
No comments:
Post a Comment