diff --git a/cleanup.py b/cleanup.py index bd94b69..ff7574a 100644 --- a/cleanup.py +++ b/cleanup.py @@ -40,19 +40,20 @@ def cleanup(offset: int = 200, limit: int = 40, id: int | None = None): iterations = offset // 40 remainder = offset % 40 # get latest posts until offset is reached - for _ in range(iterations): + for i in range(iterations): last_posts = get_account_statuses(max_id=id_oldest_of_last_posts, limit=40) if len(last_posts) == 0: print("Offset is higher than the number of posts in the past.") return id_oldest_of_last_posts = last_posts[-1]["id"] - print("Last post:", last_posts[-1]["url"]) + print(f"Currently at offset {(i + 1) * 40}, last ignored post: {last_posts[-1]['url']}") if remainder != 0: last_posts = get_account_statuses(max_id=id_oldest_of_last_posts, limit=remainder) if len(last_posts) == 0: print("Offset is higher than the number of posts in the past.") return id_oldest_of_last_posts = last_posts[-1]["id"] + print(f"Currently at offset {iterations * 40 + remainder}, last ignored post: {last_posts[-1]['url']}") else: id_oldest_of_last_posts = id last_posts = mastodon.account_statuses(getenv("MASTODON_USER_ID"), exclude_replies=True, max_id=id, limit=limit)