Get RT and QT when they are in objects of type TweetWithVisibilityResults

Этот коммит содержится в:
stygmate 2023-09-15 12:03:43 +02:00
родитель 745bc59b66
Коммит a1e60203ff

Просмотреть файл

@ -189,10 +189,24 @@ class Tweet(JSONTrait):
def parse(obj: dict, res: dict):
tw_usr = User.parse(res["users"][obj["user_id_str"]])
rt_id = _first(obj, ["retweeted_status_id_str", "retweeted_status_result.result.rest_id"])
rt_id = _first(
obj,
[
"retweeted_status_id_str",
"retweeted_status_result.result.rest_id",
"retweeted_status_result.result.tweet.rest_id"
]
)
rt_obj = get_or(res, f"tweets.{rt_id}")
qt_id = _first(obj, ["quoted_status_id_str", "quoted_status_result.result.rest_id"])
qt_id = _first(
obj,
[
"quoted_status_id_str",
"quoted_status_result.result.rest_id"
"quoted_status_result.result.tweet.rest_id"
]
)
qt_obj = get_or(res, f"tweets.{qt_id}")
doc = Tweet(