Twitter Birthday Bot

Discussion in 'Black Hat SEO Tools' started by bigchow, Dec 24, 2009.

  1. bigchow

    bigchow Junior Member

    Joined:
    May 26, 2008
    Messages:
    108
    Likes Received:
    76
    Location:
    Hong Kong
    This script is freely available at sourceforge ineed:

    http://sourceforge.net/projects/twitterbirthday/

    It is only a single pl file:

    Code:
    #!/usr/bin/perl
    
    use Net::Twitter;
    
    # set your own username and password here
    my $username = "";
    my $password = "";
    
    my $twit = Net::Twitter->new(username=>$username, password=>$password, source=>"web");
    
    my $birthdaytext = "birthday";
    
    # you can add more birthday messages here - @%s is the username 
    my @birthdaymessages = (
      "@%s have a happy birthday!",
      "@%s happy birthday!",
      "@%s have a wonderful birthday!",
      "Happy Birthday, @%s!",
      "Have a Wonderful Birthday, @%s!"
    );
    
    # get names of people you've already sent a birthday tweet
    my $prevbirthdaynames = {};
    foreach my $updates (@{ $usertimeline }) {
      my $tweet = $updates->{'text'};
      if($tweet =~ /$birthdaytext/i and $tweet =~ "@") {
        ($prevbirthdayname) = ($tweet =~ /\@(\w*)\W/);
        $prevbirthdaynames->{$prevbirthdayname} = 1;
        print "prev name: ".$prevbirthdayname."\n";
      }
    }
    
    # get names of birthday people
    my $birthdaynames = {};
    foreach my $status (@{ $twit->friends_timeline() }) {
      my $text = $status->{'text'};
      if($text =~ /$birthdaytext/i and $text =~ "@") {
        ($birthdayname) = ($text =~ /\@(\w*)\W/);
        if(!$prevbirthdaynames->{$birthdayname}) {
          $birthdaynames->{$birthdayname} = 1;
        }
      }
    }
    
    # get friends
    my $friends = {};
    foreach my $friend (@{ $twit->friends() }) {
      $friends->{$friend->{'screen_name'}} = 1;
    }
    
    # if birthday person is a friend say happy birthday
    my $nameslength = scalar keys %$birthdaynames;
    if($nameslength > 0) {
      print "Your status was just updated with birthday tweets. Here are your tweets:"."\n\n";
    }
    foreach my $name (keys %$birthdaynames) {
      if($friends->{$name}) {
        my $birthdaymessage = sprintf(@birthdaymessages[rand @birthdaymessages], $name);
        $twit->update($birthdaymessage);
        print $birthdaymessage."\n";
      }
    }
    
    if($nameslength > 0) {
      print "\n"."Love,\n".$username."\n";
    }
    
    
    Somehow I couldn't get it working. The script breaks on line 3:

    use Net::Twitter;

    I have no knowledge of coding. Anybody can suggest a fix? It will be even greater if someone can convert it into a php file. :cool2:
     
    Last edited: Dec 24, 2009
  2. bredsaal

    bredsaal Newbie

    Joined:
    Dec 10, 2009
    Messages:
    13
    Likes Received:
    4
    You need to install the Net::Twitter module for perl.

    If you are using Linux, start a terminal and type
    Code:
    sudo cpan -i Net::Twitter
    and follow the instructions on screen.

    If you use windows, I have no idea what you should do.