Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Data::Dumper;
- use Time::HiRes;
- use Net::Twitter;
- use Encode;
- use Config::Pit;
- my $config = pit_get("twitter.com", require => {
- "username" => "cool_ni_ikou",
- "password" => "your password on twitter.com"
- });
- my $twit = Net::Twitter->new(
- username => $config->{username},
- password => $config->{password},
- );
- my $count = '1';
- my (@uniq, @line, @all);
- while ( $count < 10 ) {
- my $friends = $twit->friends({page => $count });
- my $followers = $twit->followers({page => $count });
- foreach my $fri_key ( @{ $friends } ){
- push @all, $fri_key->{screen_name};
- }
- foreach my $fol_key ( @{ $followers } ){
- my $tz = encode('utf8',$fol_key->{time_zone});
- push @line, $fol_key->{screen_name} if ( $tz eq 'Tokyo' || $tz eq 'Osaka' || $tz eq 'Sapporo');
- }
- $count++;
- }
- my $num = 1;
- my %seen;
- @seen{@all} = ();
- foreach my $item (@line) {
- push(@uniq, $item) unless exists $seen{$item};
- }
- foreach my $line ( @uniq ){
- print $num.":::".$line,"\n";
- $twit->create_friend($line);
- sleep(15);
- $num++;
- }
Add Comment
Please, Sign In to add comment