Skip to content

Commit

Permalink
allow mharvester to use max_id
Browse files Browse the repository at this point in the history
  • Loading branch information
chillingo117 committed May 21, 2024
1 parent a89f2ea commit 4f6e519
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/harvesters/Mastodon/mharvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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')

Expand Down

0 comments on commit 4f6e519

Please sign in to comment.