From 108abab537ce6466f5055e6a8f66c4abc9e0fc23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 13 Mar 2024 14:46:03 +0100 Subject: [PATCH] [twitter] add 'protected' metadata field (#5327) for 'author' and 'user' --- gallery_dl/extractor/twitter.py | 1 + test/results/twitter.py | 53 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index e6bf9b0f05..e7b02496eb 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -380,6 +380,7 @@ def _transform_user(self, user): "date" : text.parse_datetime( uget("created_at"), "%a %b %d %H:%M:%S %z %Y"), "verified" : uget("verified", False), + "protected" : uget("protected", False), "profile_banner" : uget("profile_banner_url", ""), "profile_image" : uget( "profile_image_url_https", "").replace("_normal.", "."), diff --git a/test/results/twitter.py b/test/results/twitter.py index f7fd8dbae3..c94963d9d5 100644 --- a/test/results/twitter.py +++ b/test/results/twitter.py @@ -72,6 +72,59 @@ "#class" : twitter.TwitterTimelineExtractor, "#range" : "1-40", "#sha1_url": "c570ac1aae38ed1463be726cc46f31cac3d82a40", + + "author": { + "date" : "dt:2015-01-12 10:25:22", + "description" : "The very best nature pictures.", + "favourites_count": int, + "followers_count" : int, + "friends_count" : int, + "listed_count" : int, + "media_count" : int, + "statuses_count" : int, + "id" : 2976459548, + "location" : "Earth", + "name" : "supernaturepics", + "nick" : "Nature Pictures", + "profile_banner" : "https://pbs.twimg.com/profile_banners/2976459548/1421058583", + "profile_image" : "https://pbs.twimg.com/profile_images/554585280938659841/FLVAlX18.jpeg", + "protected" : False, + "verified" : False, + }, + "user": { + "date" : "dt:2015-01-12 10:25:22", + "description" : "The very best nature pictures.", + "favourites_count": int, + "followers_count" : int, + "friends_count" : int, + "listed_count" : int, + "media_count" : int, + "statuses_count" : int, + "id" : 2976459548, + "location" : "Earth", + "name" : "supernaturepics", + "nick" : "Nature Pictures", + "profile_banner" : "https://pbs.twimg.com/profile_banners/2976459548/1421058583", + "profile_image" : "https://pbs.twimg.com/profile_images/554585280938659841/FLVAlX18.jpeg", + "protected" : False, + "verified" : False, + }, + "tweet_id" : range(400000000000000000, 800000000000000000), + "conversation_id": range(400000000000000000, 800000000000000000), + "quote_id" : 0, + "reply_id" : 0, + "retweet_id" : 0, + "count" : range(1, 4), + "num" : range(1, 4), + "favorite_count" : int, + "quote_count" : int, + "reply_count" : int, + "retweet_count" : int, + "content" : str, + "lang" : str, + "date" : "type:datetime", + "sensitive" : False, + "source" : "nature_pics", }, {