From 4f6e519ecce7eacf994aa05cf81ff3a25daeb63c Mon Sep 17 00:00:00 2001 From: William Chen Date: Tue, 21 May 2024 13:39:27 +1000 Subject: [PATCH] allow mharvester to use max_id --- backend/harvesters/Mastodon/mharvester.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/harvesters/Mastodon/mharvester.py b/backend/harvesters/Mastodon/mharvester.py index 04996f4..5358d04 100644 --- a/backend/harvesters/Mastodon/mharvester.py +++ b/backend/harvesters/Mastodon/mharvester.py @@ -104,12 +104,12 @@ def ingest(recents_only = True, max_id = None): oldest_doc = response['rows'][0] print(oldest_doc) print(f'continuing retrieval of old data from {oldest_doc[0]}') - max_id = 112475922112584533 #oldest_doc[1] + max_id = max_id if max_id else oldest_doc[1] since_date = since_date.replace(tzinfo=utc) done = False while not done: - print(f'fetching toots with since_id:{since_id}, max_id:{max_id}, and up_to:{since_date}') + print(f'fetching toots with since_id:{since_id}, max_id:{max_id}, and since the date:{since_date}') # Returns toots more recent than since_id, less recent than max_id toots = m.timeline(timeline='public', since_id=since_id, max_id=max_id, limit=100) to_add = [] @@ -132,7 +132,7 @@ def ingest(recents_only = True, max_id = None): if toots and len(toots) > 0: max_id = toots[-1]['id'] - print(f'Toots had oldest date {created_at} and oldest id {max_id}') + print(f'Toots had oldest date {created_at} and largest id {max_id}') else: print(f'toots was empty')