<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-

import tweepy
import twitter
import os

consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
hashtag = "#yourhashtag"

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
bot = tweepy.API(auth)

last_id_filename = "last_id_hashtag_" + hashtag
rt_bot_path = os.path.dirname(os.path.abspath(__file__))
save_file = "last_id_hashtag_%s" % hashtag.replace("#", "")
last_id_file = os.path.join(rt_bot_path, save_file)

try:
	file = open(last_id_filename, "r")
	savepoint = file.read()
	file.close()
except IOError:
	savepoint = ""

print asctime(), "Doing a search ...",
twit = twitter.Twitter(True)

# search query
timeline = twit.search(hashtag, since_id=savepoint, max_results=999)
print len(timeline),"items found."

# filter @replies out and reverse timeline
timeline = filter(lambda status: status["text"][0] != "@", timeline)
timeline.reverse()

for status in timeline:
	print "%(screenname)s: %(statusmessage)s\n\n" \
		% {"screenname" : status["from_user"], "statusmessage" : status["text"]}
	try:
		bot.retweet(status["id"])
	except tweepy.error.TweepError:
		continue

# write last retweeted tweet id to file
if len(timeline) != 0:
	file = open(last_id_filename, "w")
	file.write(str(timeline[-1]["id"]))
	file.close()

<commit_msg>Hotfix for last commit. Date added to output. Now even more comments!<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-

import tweepy
import twitter
import os

# provide your credentials and hashtag
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
hashtag = "#yourHashtag"

# build savepoint path + file
last_id_filename = "last_id_hashtag_%s" % hashtag.replace("#", "")
rt_bot_path = os.path.dirname(os.path.abspath(__file__))
last_id_file = os.path.join(rt_bot_path, last_id_filename)

# create bot
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
bot = tweepy.API(auth)

# retrieve last savepoint if available
try:
	with open(last_id_file, "r") as file:
		savepoint = file.read()
except IOError:
	savepoint = ""
	print "No savepoint found. Trying to get as many results as possible."

# search query
twit = twitter.Twitter()
timeline = twit.search(hashtag, since_id=savepoint, max_results=999)
print "%d new items found." % len(timeline)

# filter @replies out and reverse timeline
timeline = filter(lambda status: status["text"][0] != "@", timeline)
timeline.reverse()

# iterate the timeline and retweet
for status in timeline:
	try:
		print "(%(date)s) %(name)s: %(message)s\n" % \
			{ "date" : status["created_at"].encode('utf-8'),
			"name" : status["from_user"].encode('utf-8'),
			"message" : status["text"].encode('utf-8') }

		bot.retweet(status["id"])
	except tweepy.error.TweepError:
		# just in case tweet got deleted in the meantime
		continue

# write last retweeted tweet id to file
if len(timeline) != 0:
	with open(last_id_file, "w") as file:
		file.write(str(timeline[-1]["id"]))


{'fraction_non_alphanumeric': 0.14733441033925687, 'fraction_numerical': 0.005492730210016155, 'mean_word_length': 5.383505154639176, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3332756', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1103, 'n_words': 257}