Author handling in retweeter
This commit is contained in:
parent
0b9bb2856e
commit
64cd16a640
1 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
import argparse, tools
|
||||
|
||||
def getSavepoint(db, user):
|
||||
db.executeQuery("SELECT max(tweet_id) FROM retweets WHERE author = '%s'" % user)
|
||||
db.executeQuery("SELECT MAX(tweet_id) FROM retweets WHERE LOWER(author) = '%s'" % user.lower())
|
||||
try:
|
||||
return int(db.getNext()[0])
|
||||
except:
|
||||
|
@ -19,11 +19,11 @@ def retweet(user, two=tools.twObject(), db=tools.dbHelper(tools.dbpath())):
|
|||
tw_counter = 0
|
||||
|
||||
for status in timeline:
|
||||
if status.text[0] != "@" or two.whoami() in status.text:
|
||||
if (status.text[0] != "@" or two.whoami() in status.text) and status.text[0:2] != "RT":
|
||||
timestamp = status.created_at.strftime('%Y-%m-%d %H:%M:%S') + " +0000"
|
||||
text = unescapeText(status.text)
|
||||
|
||||
db.executeQuery("INSERT INTO retweets('id','created_at','text') VALUES(" + str(status.id) + ",'" + timestamp + "','" + text + "')")
|
||||
db.executeQuery("INSERT INTO retweets('id','author','created_at','text') VALUES(" + str(status.id) + ",'" + user.lower() + "','" + timestamp + "','" + text + "')")
|
||||
db.commit()
|
||||
|
||||
two.retweet(status.id)
|
||||
|
|
Loading…
Reference in a new issue