From be3286206a5664229953c4243051413e34e96a2a Mon Sep 17 00:00:00 2001 From: ClosedPort22 <44864697+ClosedPort22@users.noreply.github.com> Date: Fri, 30 Dec 2022 13:20:55 +0800 Subject: [PATCH] [twitter] assume 'conversation_id' when using syndication not possible to expand replies at the momemt --- docs/configuration.rst | 2 +- gallery_dl/extractor/twitter.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 17f34aec..02c3abb7 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -2635,7 +2635,7 @@ Description for each Tweet in said timeline. Note: This requires at least 1 additional API call per initial Tweet. - Age-restricted Tweets cannot be expanded when using the + Age-restricted replies cannot be expanded when using the `syndication `__ API. diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index c76c0b34..a6d735c4 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -1520,6 +1520,12 @@ class TwitterAPI(): else: retweet_id = None + # assume 'conversation_id' is the same as 'id' when the tweet + # is not a reply + if "conversation_id_str" not in tweet and \ + "in_reply_to_status_id_str" not in tweet: + tweet["conversation_id_str"] = tweet["id_str"] + tweet["created_at"] = text.parse_datetime( tweet["created_at"], "%Y-%m-%dT%H:%M:%S.%fZ").strftime( "%a %b %d %H:%M:%S +0000 %Y")