[dt] replace 'text.parse_datetime()' & 'text.parse_timestamp()'
This commit is contained in:
@@ -363,11 +363,11 @@ class TwitterExtractor(Extractor):
|
||||
|
||||
tweet_id = int(legacy["id_str"])
|
||||
if tweet_id >= 300000000000000:
|
||||
date = text.parse_timestamp(
|
||||
date = self.parse_timestamp(
|
||||
((tweet_id >> 22) + 1288834974657) // 1000)
|
||||
else:
|
||||
try:
|
||||
date = text.parse_datetime(
|
||||
date = self.parse_datetime(
|
||||
legacy["created_at"], "%a %b %d %H:%M:%S %z %Y")
|
||||
except Exception:
|
||||
date = util.NONE
|
||||
@@ -455,7 +455,7 @@ class TwitterExtractor(Extractor):
|
||||
tdata, legacy["extended_entities"]["media"][0])
|
||||
if tdata["retweet_id"]:
|
||||
tdata["content"] = f"RT @{author['name']}: {tdata['content']}"
|
||||
tdata["date_original"] = text.parse_timestamp(
|
||||
tdata["date_original"] = self.parse_timestamp(
|
||||
((tdata["retweet_id"] >> 22) + 1288834974657) // 1000)
|
||||
|
||||
return tdata
|
||||
@@ -492,7 +492,7 @@ class TwitterExtractor(Extractor):
|
||||
"id": text.parse_int(cid),
|
||||
"name": com.get("name"),
|
||||
"description": com.get("description"),
|
||||
"date": text.parse_timestamp(com.get("created_at", 0) // 1000),
|
||||
"date": self.parse_timestamp(com.get("created_at", 0) // 1000),
|
||||
"nsfw": com.get("is_nsfw"),
|
||||
"role": com.get("role"),
|
||||
"member_count": com.get("member_count"),
|
||||
@@ -529,7 +529,7 @@ class TwitterExtractor(Extractor):
|
||||
"name" : core.get("screen_name"),
|
||||
"nick" : core.get("name"),
|
||||
"location" : user["location"]["location"],
|
||||
"date" : text.parse_datetime(
|
||||
"date" : self.parse_datetime(
|
||||
core["created_at"], "%a %b %d %H:%M:%S %z %Y"),
|
||||
"verified" : user["verification"]["verified"],
|
||||
"protected" : user["privacy"]["protected"],
|
||||
@@ -898,7 +898,7 @@ class TwitterBookmarkExtractor(TwitterExtractor):
|
||||
|
||||
def _transform_tweet(self, tweet):
|
||||
tdata = TwitterExtractor._transform_tweet(self, tweet)
|
||||
tdata["date_bookmarked"] = text.parse_timestamp(
|
||||
tdata["date_bookmarked"] = self.parse_timestamp(
|
||||
(int(tweet["sortIndex"] or 0) >> 20) // 1000)
|
||||
return tdata
|
||||
|
||||
|
||||
Reference in New Issue
Block a user