Only post one toot at a time

This commit is contained in:
Felix Ableitner 2018-09-04 05:07:34 +02:00
parent 6e62a96562
commit b78b1654e2

View file

@ -1,3 +1,5 @@
#!/usr/bin/python3
import os.path import os.path
import sys import sys
import feedparser import feedparser
@ -35,7 +37,7 @@ mastodon_api = None
d = feedparser.parse('http://twitrss.me/twitter_user_to_rss/?user='+twitter) d = feedparser.parse('http://twitrss.me/twitter_user_to_rss/?user='+twitter)
for t in reversed(d.entries): for t in reversed(d.entries[0:5]):
# check if this tweet has been processed # check if this tweet has been processed
db.execute('SELECT * FROM tweets WHERE tweet = ? AND twitter = ? and mastodon = ? and instance = ?',(t.id, twitter, mastodon, instance)) db.execute('SELECT * FROM tweets WHERE tweet = ? AND twitter = ? and mastodon = ? and instance = ?',(t.id, twitter, mastodon, instance))
last = db.fetchone() last = db.fetchone()
@ -104,3 +106,4 @@ for t in reversed(d.entries):
db.execute("INSERT INTO tweets VALUES ( ? , ? , ? , ? , ? )", db.execute("INSERT INTO tweets VALUES ( ? , ? , ? , ? , ? )",
(t.id, toot["id"], twitter, mastodon, instance)) (t.id, toot["id"], twitter, mastodon, instance))
sql.commit() sql.commit()
break