Skip to content

Commit

Permalink
[ie/twitter:spaces] Fix format protocol (#7550)
Browse files Browse the repository at this point in the history
Closes #7536
Authored by: bashonly
  • Loading branch information
bashonly committed Jul 15, 2023
1 parent bb5d84c commit 613dbce
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions yt_dlp/extractor/twitter.py
Expand Up @@ -1499,6 +1499,38 @@ class TwitterSpacesIE(TwitterBaseIE):
'release_date': '20220807',
},
'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 = {
Expand Down Expand Up @@ -1555,9 +1587,9 @@ def _real_extract(self, url):
source = traverse_obj(
self._call_api(f'live_video_stream/status/{metadata["media_key"]}', metadata['media_key']),
('source', ('noRedirectPlaybackUrl', 'location'), {url_or_none}), get_all=False)
formats = self._extract_m3u8_formats(
source, metadata['media_key'], 'm4a', live=is_live, fatal=False,
headers={'Referer': 'https://twitter.com/'}) if source else []
formats = self._extract_m3u8_formats( # XXX: Some Spaces need ffmpeg as downloader
source, metadata['media_key'], 'm4a', entry_protocol='m3u8', live=is_live,
headers={'Referer': 'https://twitter.com/'}, fatal=False) if source else []
for fmt in formats:
fmt.update({'vcodec': 'none', 'acodec': 'aac'})
if not is_live:
Expand Down

0 comments on commit 613dbce

Please sign in to comment.