Guest User

Untitled

a guest
Mar 11th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 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.  
  9. my $id = 'username';
  10. my $pass = 'pass';
  11.  
  12. my $twit = Net::Twitter->new(
  13. username => $id,
  14. password => $pass,
  15. );
  16.  
  17. my $count = '1';
  18. my (@uniq, @line, @all);
  19. while ( $count < 10 ) {
  20. my $friends = $twit->friends({page => $count });
  21. my $followers = $twit->followers({page => $count });
  22. foreach my $fri_key ( @{ $friends } ){
  23. push @all, $fri_key->{screen_name};
  24. }
  25. foreach my $fol_key ( @{ $followers } ){
  26. my $tz = encode('utf8',$fol_key->{time_zone});
  27. push @line, $fol_key->{screen_name} if ( $tz eq 'Tokyo' || $tz eq 'Osaka' || $tz eq 'Sapporo');
  28. }
  29. $count++;
  30. }
  31. my $num = 1;
  32. my %seen;
  33. @seen{@all} = ();
  34. foreach my $item (@line) {
  35. push(@uniq, $item) unless exists $seen{$item};
  36. }
  37.  
  38. foreach my $line ( @uniq ){
  39. print $num.":::".$line,"\n";
  40. $twit->create_friend($line);
  41. sleep(15);
  42. $num++;
  43. }
Add Comment
Please, Sign In to add comment