Guest User

Untitled

a guest
Jul 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use Net::Twitter;
  4.  
  5. $user="name"; # enter YOUR name here
  6. $passwd="password"; # enter YOUR password here
  7.  
  8. $start_id=55097; # enter YOUR start id here
  9. $max_lvl=2; # search depth
  10.  
  11. $curr_lvl=0;
  12. %friendsIDs=();
  13. $friendsIDs{$start_id}=$curr_lvl;
  14.  
  15. $nt = Net::Twitter->new(username => $user, password => $passwd, identica=>1);
  16.  
  17. # blacklist, friends of this ID are not checked
  18. %blacklist=(
  19. 11329 => 1 # had to blacklist RMS
  20. );
  21.  
  22. # direct friends of start ID - not to be displayed
  23. $already_known{$start_id}=0;
  24. $p = $nt->friends_ids($start_id);
  25. foreach $id (@$p){
  26. $already_known{$id}=$start_id;
  27. }
  28.  
  29. # gathering users IDs
  30. while ($curr_lvl < $max_lvl){
  31. foreach $checkid (keys %friendsIDs){
  32. print "Checking $checkid LVL $curr_lvl\n";
  33. if (! defined $checkedIDs{$checkid}){
  34. $checkedIDs{$checkid}=1;
  35. $p = $nt->friends_ids($checkid);
  36. foreach $id (@$p){
  37. if (! defined $friendsIDs{$id} && ! defined $blacklist{$checkid}){
  38. $friendsIDs{$id}=$checkid;
  39. print "Adding new ID: $id\n";
  40. }
  41. else {
  42. # print "Not adding already added $id\n";
  43. }
  44. }
  45. }
  46. else {
  47. # print "Skipping already checked $checkid\n";
  48. }
  49. }
  50. $curr_lvl++;
  51. }
  52.  
  53. # displaying data for gathered ID's
  54. foreach $id (keys %friendsIDs){
  55. if (! defined $already_known{$id}){
  56. $i++;
  57. $lvl = $friendsIDs{$id};
  58. $v = $nt->show_user($id);
  59. print "Counter\t$i\n";
  60. print "From\t\t$friendsIDs{$id}\n";
  61. print "screen name\t$$v{screen_name}\n";
  62. print "URL\t\t$$v{'statusnet_profile_url'}\n";
  63. print "description\t$$v{description}\n";
  64. print "location\t$$v{location}\n";
  65. print "User ID\t\t$id\n\n";
  66. }
  67. }
Add Comment
Please, Sign In to add comment