From b78b1654e229d77309f1d3917b48dcb32c612624 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 4 Sep 2018 05:07:34 +0200 Subject: [PATCH] Only post one toot at a time --- tootbot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tootbot.py b/tootbot.py index 21c103a..c35aa41 100755 --- a/tootbot.py +++ b/tootbot.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + import os.path import sys import feedparser @@ -35,7 +37,7 @@ mastodon_api = None 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 db.execute('SELECT * FROM tweets WHERE tweet = ? AND twitter = ? and mastodon = ? and instance = ?',(t.id, twitter, mastodon, instance)) last = db.fetchone() @@ -104,3 +106,4 @@ for t in reversed(d.entries): db.execute("INSERT INTO tweets VALUES ( ? , ? , ? , ? , ? )", (t.id, toot["id"], twitter, mastodon, instance)) sql.commit() + break