Skip to content

Commit 8056c79

Browse files
committed
twitter.archive: workaround for broken dates in some archive tweets
1 parent 2bbf98a commit 8056c79

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/my/twitter/archive.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ def tweets(self) -> Iterator[Tweet]:
217217
# NOTE: for some reason, created_at doesn't seem to be in order
218218
# it mostly is, but there are a bunch of one-off random tweets where the time decreases (typically at the very end)
219219
for r in self.raw(what='tweet', fname=fname):
220+
created_at_str = r['created_at']
221+
created_at_year = int(created_at_str[-4:])
222+
if created_at_year < 2006: # twitter didn't exist before that
223+
# had a couple of tweets with 1997/2003 as year... in 2025-09-17 export... possibly some exporter bug
224+
# for now just ignore
225+
continue
220226
yield Tweet(r, screen_name=self.screen_name)
221227

222228
def likes(self) -> Iterator[Like]:

0 commit comments

Comments
 (0)