From 8ef66a31736adf2b0b8928fa94eb8e800f25e7c8 Mon Sep 17 00:00:00 2001 From: Mort Yao <soi@mort.ninja> Date: Sun, 23 Oct 2022 18:46:33 +0200 Subject: [PATCH] [twitter] if the tweet contains video from another tweet, download it --- src/you_get/extractors/twitter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/you_get/extractors/twitter.py b/src/you_get/extractors/twitter.py index 24a8c12c..c80eb211 100644 --- a/src/you_get/extractors/twitter.py +++ b/src/you_get/extractors/twitter.py @@ -62,6 +62,13 @@ def twitter_download(url, output_dir='.', merge=True, info_only=False, **kwargs) # if the tweet contains media, download them media = info['globalObjects']['tweets'][item_id]['extended_entities']['media'] + elif 'entities' in info['globalObjects']['tweets'][item_id]: + # if the tweet contains video from another tweet, download it + # FIXME: multiple urls? + expanded_url = info['globalObjects']['tweets'][item_id]['entities']['urls'][0]['expanded_url'] + item_id = r1(r'/(\d+)/video', expanded_url) + assert False + elif info['globalObjects']['tweets'][item_id].get('is_quote_status') == True: # if the tweet does not contain media, but it quotes a tweet # and the quoted tweet contains media, download them