<commit_before>author__ = '<NAME>'

# I'd like to give github user 'timster' credit for optimizing a lot of rough bits in the code, he's helped a lot.

# This was a quick project. Inspired by a story I heard of on the news where a guy did something almost exactly the same
#  and won a bunch of stuff. I couldn't find the code that that guy used (I don't think he wanted to release it), so I
# wrote this. Have fun.

import tweepy, time

#enter the corresponding information from your Twitter application:

CONSUMER_KEY = '' #keep the quotes, enter your consumer key
CONSUMER_SECRET = ''#keep the quotes, enter your consumer secret key
ACCESS_KEY = ''#keep the quotes, enter your access token
ACCESS_SECRET =  ''#keep the quotes, enter your access token secret

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)

keywords = [
    "rt to", "rt and win", "retweet and win",
    "rt for", "rt 4", "retweet to"
]


def search(twts):
    for i in twts:
        if not any(k in i.text.lower() for k in keywords):
            continue
        # Retweets
        api.retweet(i.id)
        print "JUST RETWEETED " + (i.text)
        # Follows
        if "follow" in i.text.lower():
            username = i.user.screen_name
            api.create_friendship(username)
            print "JUST FOLLOWED " + str(username)
        # Favorites
        if "fav" in i.text.lower():
            api.create_favorite(i.id)
            print "JUST FAVORITED " + (i.text)
        time.sleep(60)


def run():
    for key in ["RT to win", "retweet to win"]:
        print "************************"
        print "\n...Refreshing searched tweets...\n"
        print "************************"
        search(api.search(q=key))


if __name__ == '__main__':
    print "Thank you for using my twitter contest-entering bot.\nConsider leaving a star if you like it."
    print "https://github.com/robbiebarrat/twitter-contest-enterer\n"
    print "Also -- if you run this for too long it will get your account suspended. I'd suggest using it on a 'test account'" \
          "\nand only letting it run for a short time every day."<commit_msg>Update twitterbot.py<commit_after>author__ = '<NAME>'

# I'd like to give github user 'timster' credit for optimizing a lot of rough bits in the code, he's helped a lot.

# This was a quick project. Inspired by a story I heard of on the news where a guy did something almost exactly the same
#  and won a bunch of stuff. I couldn't find the code that that guy used (I don't think he wanted to release it), so I
# wrote this. Have fun.

import tweepy, time

#enter the corresponding information from your Twitter application:

CONSUMER_KEY = '' #keep the quotes, enter your consumer key
CONSUMER_SECRET = ''#keep the quotes, enter your consumer secret key
ACCESS_KEY = ''#keep the quotes, enter your access token
ACCESS_SECRET =  ''#keep the quotes, enter your access token secret

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)

keywords = [
    "rt to", "rt and win", "retweet and win",
    "rt for", "rt 4", "retweet to"
]


def search(twts):
    for i in twts:
        if not any(k in i.text.lower() for k in keywords):
            continue
        # Retweets
        api.retweet(i.id)
        print "JUST RETWEETED " + (i.text)
        # Follows
        if "follow" in i.text or "Follow" in i.text or "FOLLOW" in i.text:
            username = i.user.screen_name
            api.create_friendship(username)
            print "JUST FOLLOWED " + str(username)
        # Favorites
        if "fav" in i.text or "Fav" in i.text or "FAV" in i.text:
            api.create_favorite(i.id)
            print "JUST FAVORITED " + (i.text)
        time.sleep(60)


def run():
    for key in ["RT to win", "retweet to win"]:
        print "************************"
        print "\n...Refreshing searched tweets...\n"
        print "************************"
        search(api.search(q=key))


if __name__ == '__main__':
    print "Thank you for using my twitter contest-entering bot.\nConsider leaving a star if you like it."
    print "https://github.com/robbiebarrat/twitter-contest-enterer\n"
    print "Also -- if you run this for too long it will get your account suspended. I'd suggest using it on a 'test account'" \
          "\nand only letting it run for a short time every day."
{'fraction_non_alphanumeric': 0.11768661735036987, 'fraction_numerical': 0.0013449899125756557, 'mean_word_length': 2.836629406706793, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5724590', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1347, 'n_words': 540}