Last active
September 11, 2016 23:21
-
-
Save hutt/48255dcd42599b032259707915b85971 to your computer and use it in GitHub Desktop.
Das Maß ist voll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#coding=UTF-8 | |
#file: bot.py | |
# | |
#requirements: | |
#keys.py | |
#tweeps ("pip install tweeps") | |
# | |
import tweepy, time, sys, random | |
#from our keys module (keys.py), import the keys dictionary | |
from keys import keys | |
CONSUMER_KEY = keys['consumer_key'] | |
CONSUMER_SECRET = keys['consumer_secret'] | |
ACCESS_TOKEN = keys['access_token'] | |
ACCESS_TOKEN_SECRET = keys['access_token_secret'] | |
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) | |
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET) | |
api = tweepy.API(auth) | |
replys = [ | |
'Alkohol ist eine gefährliche Droge.', | |
'Alkohol? Gefährliche Droge.', | |
'Alkohol ist eine böse Droge.', | |
'Alkohol? Böse Droge.', | |
'Alkohol ist eine üble Droge.', | |
'Alkohol? Üble Droge.', | |
'Alkohol ist eine schädliche Droge.', | |
'Alkohol? Schädliche Droge.', | |
'Alkohol ist eine miese Droge.', | |
'Alkohol? Miese Droge.', | |
'Alkohol ist eine schlimme Droge.', | |
'Alkohol? Schlimme Droge.', | |
'Alkohol ist eine teuflische Droge.', | |
'Alkohol? Teuflische Droge.', | |
'Keine Macht dem Alkohol.', | |
'Alkohol kann tödlich sein.', | |
'Alkohol ist tödlich.', | |
'Alkohol schadet Ihnen und den Menschen in Ihrer Umgebung.' | |
] | |
t = [ | |
'Absinth', | |
'Altbier', | |
'Aquavit', | |
'Craft-Bier', | |
'Craftbier', | |
'Bier', | |
'Bockbier', | |
'Brandy', | |
'Cachaca', | |
'Calvados', | |
'Cidre', | |
'Cognac', | |
'Gin', | |
'Grappa', | |
'Kölsch', | |
'Likör', | |
'Met', | |
'Mescal', | |
'Pfeffi', | |
'Pils', | |
'Portwein', | |
'Rotwein', | |
'Schnaps', | |
'Sekt', | |
'Sherry', | |
'Tequilla', | |
'Vodka', | |
'Wein', | |
'Weißbier', | |
'Weißwein', | |
'Wermut', | |
'Whiskey', | |
'Whisky', | |
'Wodka' | |
] | |
searchterms = ' OR '.join(t) | |
search = "lang:de (" + searchterms + ") -from:MassIstVoll" | |
print search | |
twts = api.search(q=search) | |
limit = 25 | |
count = 0 | |
for s in twts: | |
if count < limit: | |
for i in t: | |
sn = s.user.screen_name | |
if sn != "MassIstVoll": | |
m = u".@" + sn + u" " + unicode(random.choice(replys), 'utf-8') + u" Probieren Sie doch etwas anderes aus!" | |
s = api.update_status(m, s.id) | |
count=count+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#coding=UTF-8 | |
#keys.py | |
#visit http://dev.twitter.com to create an application and get your keys | |
keys = dict( | |
consumer_key = '', | |
consumer_secret = '', | |
access_token = '', | |
access_token_secret = '', | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment