[ie/twitter:spaces] Fix format protocol (#7550)

Closes #7536
Authored by: bashonly
This commit is contained in:
bashonly 2023-07-15 16:10:12 -05:00 committed by GitHub
parent bb5d84c9d2
commit 613dbce177
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1499,6 +1499,38 @@ class TwitterSpacesIE(TwitterBaseIE):
'release_date': '20220807', 'release_date': '20220807',
}, },
'params': {'skip_download': 'm3u8'}, 'params': {'skip_download': 'm3u8'},
}, {
# post_live/TimedOut but downloadable
'url': 'https://twitter.com/i/spaces/1vAxRAVQWONJl',
'info_dict': {
'id': '1vAxRAVQWONJl',
'ext': 'm4a',
'title': 'Framing Up FinOps: Billing Tools',
'description': 'Twitter Space participated by rupa, Alfonso Hernandez',
'uploader': 'Google Cloud',
'uploader_id': 'googlecloud',
'live_status': 'post_live',
'timestamp': 1681409554,
'upload_date': '20230413',
'release_timestamp': 1681839000,
'release_date': '20230418',
},
'params': {'skip_download': 'm3u8'},
}, {
# Needs ffmpeg as downloader, see: https://github.com/yt-dlp/yt-dlp/issues/7536
'url': 'https://twitter.com/i/spaces/1eaKbrQbjoRKX',
'info_dict': {
'id': '1eaKbrQbjoRKX',
'ext': 'm4a',
'title': '',
'description': 'Twitter Space participated by nobody yet',
'uploader': '息根とめる🔪Twitchで復活',
'uploader_id': 'tomeru_ikinone',
'live_status': 'was_live',
'timestamp': 1685617198,
'upload_date': '20230601',
},
'params': {'skip_download': 'm3u8'},
}] }]
SPACE_STATUS = { SPACE_STATUS = {
@ -1555,9 +1587,9 @@ def _real_extract(self, url):
source = traverse_obj( source = traverse_obj(
self._call_api(f'live_video_stream/status/{metadata["media_key"]}', metadata['media_key']), self._call_api(f'live_video_stream/status/{metadata["media_key"]}', metadata['media_key']),
('source', ('noRedirectPlaybackUrl', 'location'), {url_or_none}), get_all=False) ('source', ('noRedirectPlaybackUrl', 'location'), {url_or_none}), get_all=False)
formats = self._extract_m3u8_formats( formats = self._extract_m3u8_formats( # XXX: Some Spaces need ffmpeg as downloader
source, metadata['media_key'], 'm4a', live=is_live, fatal=False, source, metadata['media_key'], 'm4a', entry_protocol='m3u8', live=is_live,
headers={'Referer': 'https://twitter.com/'}) if source else [] headers={'Referer': 'https://twitter.com/'}, fatal=False) if source else []
for fmt in formats: for fmt in formats:
fmt.update({'vcodec': 'none', 'acodec': 'aac'}) fmt.update({'vcodec': 'none', 'acodec': 'aac'})
if not is_live: if not is_live: