Skip to content

Commit

Permalink
[twitter] add 'birdwatch' metadata field (#5317)
Browse files Browse the repository at this point in the history
should probably get a better name,
but this is what it's called internally by Twitter
  • Loading branch information
mikf committed Mar 18, 2024
1 parent b8e7be2 commit 8e694d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gallery_dl/extractor/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions test/results/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit 8e694d8

Please sign in to comment.