From 94143eb86c2e608989aa861a5da15e7fd006a6cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 25 Sep 2021 18:15:14 +0200 Subject: [PATCH] [twitter] add 'quote_by' metadata field (#1481) Only present for tweets quoted by another tweet. Represents the tweet_id of said tweet quoting this one. --- gallery_dl/extractor/twitter.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index 98a45581..4a3f6cd9 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -50,7 +50,7 @@ class TwitterExtractor(Extractor): if not self.retweets and "retweeted_status_id_str" in tweet: self.log.debug("Skipping %s (retweet)", tweet["id_str"]) continue - if not self.quoted and "quoted" in tweet: + if not self.quoted and "quoted_by_id_str" in tweet: self.log.debug("Skipping %s (quoted tweet)", tweet["id_str"]) continue if "in_reply_to_user_id_str" in tweet and ( @@ -201,6 +201,8 @@ class TwitterExtractor(Extractor): if "in_reply_to_screen_name" in tweet: tdata["reply_to"] = tweet["in_reply_to_screen_name"] + if "quoted_by_id_str" in tweet: + tdata["quote_by"] = text.parse_int(tweet["quoted_by_id_str"]) if "author" in tweet: tdata["author"] = self._transform_user(tweet["author"]) @@ -905,7 +907,7 @@ class TwitterAPI(): quoted = quoted.copy() quoted["author"] = users[quoted["user_id_str"]] quoted["user"] = tweet["user"] - quoted["quoted"] = True + quoted["quoted_by_id_str"] = tweet["id_str"] yield quoted # update cursor value