aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2023-09-08 18:09:15 +0000
committerjwansek <eddie.atten.ea29@gmail.com>2023-09-08 18:09:15 +0000
commit765f681cecfcd2ca0d0de5a3a44d30e7476277e6 (patch)
treea0fa0f26d1b9030ac4fb4b1e451ecb4de31c5e3c
parentaca2ed9396e8c39f5dd7b33c44458c8b61f55939 (diff)
downloadboymoder.blog-765f681cecfcd2ca0d0de5a3a44d30e7476277e6.tar.gz
boymoder.blog-765f681cecfcd2ca0d0de5a3a44d30e7476277e6.zip
Fixed bug in fetching tweets SQL command
-rw-r--r--[-rwxr-xr-x]database.py14
-rwxr-xr-xservices.py4
2 files changed, 11 insertions, 7 deletions
diff --git a/database.py b/database.py
index ea3835c..f3a181c 100755..100644
--- a/database.py
+++ b/database.py
@@ -135,7 +135,7 @@ class Database:
def get_cached_tweets(self, numToGet = None):
with self.__connection.cursor() as cursor:
- sql = "SELECT tweet, tweet_id, account FROM diary WHERE account = %s ORDER BY tweeted_at"
+ sql = "SELECT tweet, tweet_id, account FROM diary WHERE account = %s ORDER BY tweeted_at DESC"
args = (self.config.get("twitter", "main_account"), )
if numToGet is not None:
sql += " LIMIT %s;"
@@ -330,8 +330,12 @@ def update_cache():
for image in images:
db.append_diary_images(id_, image)
print("Finished getting diary tweets...")
+ main_account = db.config.get("twitter", "main_account")
+ oldest_tweet = db.get_newest_diary_tweet_id(main_account)
+ print("Fetching tweets from account '%s' older than %d" % (main_account, oldest_tweet))
for id_, dt, replying_to, text, username, images in services.scrape_nitter(
- db.config.get("twitter", "main_account"), db.get_newest_diary_tweet_id(db.config.get("twitter", "main_account"))
+ main_account,
+ oldest_tweet
):
db.append_diary(id_, dt, replying_to, text, username)
for image in images:
@@ -340,7 +344,7 @@ def update_cache():
if __name__ == "__main__":
- with Database() as db:
- print(db.get_cached_tweets())
+ #with Database() as db:
+ # print(db.get_cached_tweets(7))
- # update_cache()
+ update_cache()
diff --git a/services.py b/services.py
index ee98677..9bbac3f 100755
--- a/services.py
+++ b/services.py
@@ -330,7 +330,7 @@ def parse_tweet(tweet_url):
if __name__ == "__main__":
# print(get_trans_stats())
- print(scrape_nitter(CONFIG.get("twitter", "diary_account"), 1697430888617840909))
+ #print(scrape_nitter(CONFIG.get("twitter", "diary_account"), 1697430888617840909))
print(scrape_nitter("estrogenizedboy", 1698107440489734640))
- # print(parse_tweet("https://nitter.net/HONMISGENDERER/status/1694231618443981161#m")) \ No newline at end of file
+ # print(parse_tweet("https://nitter.net/HONMISGENDERER/status/1694231618443981161#m"))