From 8e694d85c4e61950811508b040559b0918c06d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 16 Mar 2024 02:02:02 +0100 Subject: [PATCH] [twitter] add 'birdwatch' metadata field (#5317) should probably get a better name, but this is what it's called internally by Twitter --- gallery_dl/extractor/twitter.py | 2 ++ test/results/twitter.py | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index 87feeba9c0a..a5bd98401ba 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -340,6 +340,8 @@ def _transform_tweet(self, tweet): txt, _, tco = content.rpartition(" ") tdata["content"] = txt if tco.startswith("https://t.co/") else content + if "birdwatch_pivot" in tweet: + tdata["birdwatch"] = tweet["birdwatch_pivot"]["subtitle"]["text"] if "in_reply_to_screen_name" in legacy: tdata["reply_to"] = legacy["in_reply_to_screen_name"] if "quoted_by" in legacy: diff --git a/test/results/twitter.py b/test/results/twitter.py index c94963d9d56..cc41d9ca470 100644 --- a/test/results/twitter.py +++ b/test/results/twitter.py @@ -590,6 +590,17 @@ "The analysis by Texas A&M University seems to contradict statements by state and federal regulators that air near the crash site is completely safe, despite residents complaining about rashes, breathing problems and other health effects." Your reaction.""", }, +{ + "#url" : "https://twitter.com/KrisKobach1787/status/1765935595702919299", + "#comment" : "'birdwatch' note (#5317)", + "#category": ("", "twitter", "tweet"), + "#class" : twitter.TwitterTweetExtractor, + "#options" : {"text-tweets": True}, + + "birdwatch": "In addition to the known harm of lead exposure, especially to children, Mr. Kobach is incorrect when he states the mandate is unfunded. In fact, the BIPARTISAN Infrastructure Law Joe Biden signed into law in Nov 2021 provides $15B toward lead service line replacement projects. epa.gov/ground-water-a…", + "content" : "Biden wants to replace lead pipes. He failed to mention that the unfunded mandate sets an almost impossible timeline, will cost billions, infringe on the rights of the States and their residents – all for benefits that may be entirely speculative. #sotu https://ag.ks.gov/media-center/news-releases/2024/02/09/kobach-leads-coalition-demanding-biden-drop-unnecessary-epa-rule", +}, + { "#url" : "https://twitter.com/playpokemon/status/1263832915173048321/quotes", "#category": ("", "twitter", "quotes"),