twitter.twint: localize timestamps correctly
same issue as discussed here https://memex.zulipchat.com/#narrow/stream/279610-data/topic/google.20takeout.20timestamps also see corresponding changes for google_takeout_parser - https://github.com/seanbreckenridge/google_takeout_parser/pull/28/files - https://github.com/seanbreckenridge/google_takeout_parser/pull/30/files
This commit is contained in:
parent
e3f376d64f
commit
3c6f45ce83
2 changed files with 23 additions and 12 deletions
|
@ -26,7 +26,7 @@ from typing import NamedTuple, Iterator, List
|
|||
from pathlib import Path
|
||||
|
||||
from ..core.common import get_files, LazyLogger, Json, datetime_aware
|
||||
from ..core.time import abbr_to_timezone
|
||||
from ..core.time import localize_with_abbr
|
||||
|
||||
log = LazyLogger(__name__)
|
||||
|
||||
|
@ -49,9 +49,8 @@ class Tweet(NamedTuple):
|
|||
def created_at(self) -> datetime_aware:
|
||||
seconds = self.row['created_at'] / 1000
|
||||
tz_abbr = self.row['timezone']
|
||||
tz = abbr_to_timezone(tz_abbr)
|
||||
dt = datetime.fromtimestamp(seconds, tz=tz)
|
||||
return dt
|
||||
naive = datetime.fromtimestamp(seconds)
|
||||
return localize_with_abbr(naive, abbr=tz_abbr)
|
||||
|
||||
@property
|
||||
def screen_name(self) -> str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue