Skip to content

Commit

Permalink
Log the number of tweets fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
andylolz committed May 12, 2024
1 parent b72305f commit 07254a3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions x_notes/tweets.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def get_next_unfetched_note(notes: dict[str, dict[str, Any]]) -> dict[str, Any]

api = await login()

total_fetched = 0
while True:
note = get_next_unfetched_note(notes)
if not note:
Expand All @@ -65,6 +66,7 @@ def get_next_unfetched_note(notes: dict[str, dict[str, Any]]) -> dict[str, Any]
api = await login()
continue
note["dl"] = 1
total_fetched += 1
if tweet:
note["lang"] = tweet.lang
note["user"] = tweet.user.username
Expand All @@ -73,4 +75,5 @@ def get_next_unfetched_note(notes: dict[str, dict[str, Any]]) -> dict[str, Any]
note["deleted"] = 1
notes[note_id] = note

print(f"Total fetched: {total_fetched}")
save_notes(notes)

0 comments on commit 07254a3

Please sign in to comment.