Eliminating duplicate handles from comments
This commit is contained in:
parent
fec551476d
commit
daee1c6ea9
|
@ -35,6 +35,7 @@ while True:
|
||||||
sender = status.user.screen_name.encode("UTF-8")
|
sender = status.user.screen_name.encode("UTF-8")
|
||||||
twid = int(status.id)
|
twid = int(status.id)
|
||||||
comment = ""
|
comment = ""
|
||||||
|
wordlist = []
|
||||||
if "storn" in text.lower():
|
if "storn" in text.lower():
|
||||||
try:
|
try:
|
||||||
api.update_status("@%s Okay, dein Wecktweet wurde storniert." % sender, twid)
|
api.update_status("@%s Okay, dein Wecktweet wurde storniert." % sender, twid)
|
||||||
|
@ -72,8 +73,12 @@ while True:
|
||||||
|
|
||||||
words = text.split(" ")
|
words = text.split(" ")
|
||||||
for word in words:
|
for word in words:
|
||||||
if word[0] == "@":
|
if word[0] == "@" and (not user == word[1:]) and (not sender == word[1:]):
|
||||||
comment += word + " "
|
wordlist += word
|
||||||
|
|
||||||
|
wordlist = list(set(wordlist))
|
||||||
|
for word in wordlist:
|
||||||
|
comment += word + " "
|
||||||
|
|
||||||
cur.execute("INSERT INTO tweets VALUES(%i,'%s','%s','%s',0)" % (twid,date.strftime("%Y-%m-%dT%H:%M:%S"),sender,comment.strip()))
|
cur.execute("INSERT INTO tweets VALUES(%i,'%s','%s','%s',0)" % (twid,date.strftime("%Y-%m-%dT%H:%M:%S"),sender,comment.strip()))
|
||||||
sql_conn.commit()
|
sql_conn.commit()
|
||||||
|
|
Loading…
Reference in a new issue