Skip to content

Instantly share code, notes, and snippets.

@Zulko
Forked from howdydoody123/analyze.py
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save Zulko/f8735acf94cc97d6c53d to your computer and use it in GitHub Desktop.

Select an option

Save Zulko/f8735acf94cc97d6c53d to your computer and use it in GitHub Desktop.
'''
Rewrite with Twittcher ;) (Not tested)
'''
import twittcher
watched_words = ["racist", "white", "teargas", "rifle", "camera", "milk"]
wordcounts = {word:0 for word in watched_words}
def action(tweet):
found_at_least_one = False
for word in watched_words:
if word in tweet.text:
wordcounts[word] += 1
found_at_least_one = True
if found_at_least_one:
print( "Found one ! Current count:", wordcounts)
bot = SearchWatcher("ferguson", action=action)
bot.watch_every(20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment