Guest User

Untitled

a guest
Mar 11th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Data::Dumper;
  5. use Time::HiRes;
  6. use Net::Twitter;
  7. use Encode;
  8. use Config::Pit;
  9.  
  10. my $config = pit_get("twitter.com", require => {
  11. "username" => "cool_ni_ikou",
  12. "password" => "your password on twitter.com"
  13. });
  14.  
  15. my $twit = Net::Twitter->new(
  16. username => $config->{username},
  17. password => $config->{password},
  18. );
  19.  
  20. my $count = '1';
  21. my (@uniq, @line, @all);
  22. while ( $count < 10 ) {
  23. my $friends = $twit->friends({page => $count });
  24. my $followers = $twit->followers({page => $count });
  25. foreach my $fri_key ( @{ $friends } ){
  26. push @all, $fri_key->{screen_name};
  27. }
  28. foreach my $fol_key ( @{ $followers } ){
  29. my $tz = encode('utf8',$fol_key->{time_zone});
  30. push @line, $fol_key->{screen_name} if ( $tz eq 'Tokyo' || $tz eq 'Osaka' || $tz eq 'Sapporo');
  31. }
  32. $count++;
  33. }
  34. my $num = 1;
  35. my %seen;
  36. @seen{@all} = ();
  37. foreach my $item (@line) {
  38. push(@uniq, $item) unless exists $seen{$item};
  39. }
  40.  
  41. foreach my $line ( @uniq ){
  42. print $num.":::".$line,"\n";
  43. $twit->create_friend($line);
  44. sleep(15);
  45. $num++;
  46. }
Add Comment
Please, Sign In to add comment