Improve duplicate handling
This commit is contained in:
parent
5ad1fac2cc
commit
b7b619ba0b
22
getter.py
22
getter.py
|
@ -70,16 +70,18 @@ while True:
|
||||||
print "Error in " + str(twid)
|
print "Error in " + str(twid)
|
||||||
print e
|
print e
|
||||||
continue
|
continue
|
||||||
|
|
||||||
words = text.split(" ")
|
words = text.split(" ")
|
||||||
for word in words:
|
for word in words:
|
||||||
if word[0] == "@" and (not user == word[1:]) and (not sender == word[1:]):
|
wordlist += word
|
||||||
wordlist += word
|
|
||||||
|
wordlist = list(set(wordlist))
|
||||||
wordlist = list(set(wordlist))
|
try:
|
||||||
for word in wordlist:
|
wordlist.remove(user)
|
||||||
comment += word + " "
|
wordlist.remove(sender)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
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