[twitter] Fix video in quoted tweets

Closes #2254
This commit is contained in:
pukkandan 2022-01-10 18:50:01 +05:30
parent d6579d532b
commit f1150b9e1e
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698
1 changed files with 3 additions and 2 deletions

View File

@ -15,6 +15,7 @@ from ..utils import (
ExtractorError, ExtractorError,
float_or_none, float_or_none,
int_or_none, int_or_none,
traverse_obj,
try_get, try_get,
strip_or_none, strip_or_none,
unified_timestamp, unified_timestamp,
@ -55,7 +56,7 @@ class TwitterBaseIE(InfoExtractor):
def _extract_formats_from_vmap_url(self, vmap_url, video_id): def _extract_formats_from_vmap_url(self, vmap_url, video_id):
vmap_url = url_or_none(vmap_url) vmap_url = url_or_none(vmap_url)
if not vmap_url: if not vmap_url:
return [] return [], {}
vmap_data = self._download_xml(vmap_url, video_id) vmap_data = self._download_xml(vmap_url, video_id)
formats = [] formats = []
subtitles = {} subtitles = {}
@ -508,7 +509,7 @@ class TwitterIE(TwitterBaseIE):
'duration': float_or_none(video_info.get('duration_millis'), 1000), 'duration': float_or_none(video_info.get('duration_millis'), 1000),
}) })
media = try_get(status, lambda x: x['extended_entities']['media'][0]) media = traverse_obj(status, ((None, 'quoted_status'), 'extended_entities', 'media', 0), get_all=False)
if media and media.get('type') != 'photo': if media and media.get('type') != 'photo':
extract_from_video_info(media) extract_from_video_info(media)
else: else: