mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-22 02:15:12 +00:00
[ie/twitter:spaces] Support video spaces (#10789)
Authored by: bashonly
This commit is contained in:
parent
c8d096c5ce
commit
bef1d4d6fc
1 changed files with 35 additions and 9 deletions
|
@ -1764,7 +1764,7 @@ class TwitterSpacesIE(TwitterBaseIE):
|
||||||
'release_timestamp': 1659904215,
|
'release_timestamp': 1659904215,
|
||||||
'release_date': '20220807',
|
'release_date': '20220807',
|
||||||
},
|
},
|
||||||
'params': {'skip_download': 'm3u8'},
|
'skip': 'No longer available',
|
||||||
}, {
|
}, {
|
||||||
# post_live/TimedOut but downloadable
|
# post_live/TimedOut but downloadable
|
||||||
'url': 'https://twitter.com/i/spaces/1vAxRAVQWONJl',
|
'url': 'https://twitter.com/i/spaces/1vAxRAVQWONJl',
|
||||||
|
@ -1780,6 +1780,8 @@ class TwitterSpacesIE(TwitterBaseIE):
|
||||||
'upload_date': '20230413',
|
'upload_date': '20230413',
|
||||||
'release_timestamp': 1681839000,
|
'release_timestamp': 1681839000,
|
||||||
'release_date': '20230418',
|
'release_date': '20230418',
|
||||||
|
'protocol': 'm3u8', # ffmpeg is forced
|
||||||
|
'container': 'm4a_dash', # audio-only format fixup is applied
|
||||||
},
|
},
|
||||||
'params': {'skip_download': 'm3u8'},
|
'params': {'skip_download': 'm3u8'},
|
||||||
}, {
|
}, {
|
||||||
|
@ -1790,11 +1792,31 @@ class TwitterSpacesIE(TwitterBaseIE):
|
||||||
'ext': 'm4a',
|
'ext': 'm4a',
|
||||||
'title': 'あ',
|
'title': 'あ',
|
||||||
'description': 'Twitter Space participated by nobody yet',
|
'description': 'Twitter Space participated by nobody yet',
|
||||||
'uploader': '息根とめる🔪Twitchで復活',
|
'uploader': '息根とめる',
|
||||||
'uploader_id': 'tomeru_ikinone',
|
'uploader_id': 'tomeru_ikinone',
|
||||||
'live_status': 'was_live',
|
'live_status': 'was_live',
|
||||||
'timestamp': 1685617198,
|
'timestamp': 1685617198,
|
||||||
'upload_date': '20230601',
|
'upload_date': '20230601',
|
||||||
|
'protocol': 'm3u8', # ffmpeg is forced
|
||||||
|
'container': 'm4a_dash', # audio-only format fixup is applied
|
||||||
|
},
|
||||||
|
'params': {'skip_download': 'm3u8'},
|
||||||
|
}, {
|
||||||
|
# Video Space
|
||||||
|
'url': 'https://x.com/i/spaces/1DXGydznBYWKM',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1DXGydznBYWKM',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'America and Israel’s “special relationship”',
|
||||||
|
'description': 'Twitter Space participated by nobody yet',
|
||||||
|
'uploader': 'Candace Owens',
|
||||||
|
'uploader_id': 'RealCandaceO',
|
||||||
|
'live_status': 'was_live',
|
||||||
|
'timestamp': 1723931351,
|
||||||
|
'upload_date': '20240817',
|
||||||
|
'release_timestamp': 1723932000,
|
||||||
|
'release_date': '20240817',
|
||||||
|
'protocol': 'm3u8_native', # not ffmpeg, detected as video space
|
||||||
},
|
},
|
||||||
'params': {'skip_download': 'm3u8'},
|
'params': {'skip_download': 'm3u8'},
|
||||||
}]
|
}]
|
||||||
|
@ -1854,13 +1876,17 @@ 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( # XXX: Some Spaces need ffmpeg as downloader
|
is_audio_space = source and 'audio-space' in source
|
||||||
source, metadata['media_key'], 'm4a', entry_protocol='m3u8', live=is_live,
|
formats = self._extract_m3u8_formats(
|
||||||
headers=headers, fatal=False) if source else []
|
source, metadata['media_key'], 'm4a' if is_audio_space else 'mp4',
|
||||||
for fmt in formats:
|
# XXX: Some audio-only Spaces need ffmpeg as downloader
|
||||||
fmt.update({'vcodec': 'none', 'acodec': 'aac'})
|
entry_protocol='m3u8' if is_audio_space else 'm3u8_native',
|
||||||
if not is_live:
|
live=is_live, headers=headers, fatal=False) if source else []
|
||||||
fmt['container'] = 'm4a_dash'
|
if is_audio_space:
|
||||||
|
for fmt in formats:
|
||||||
|
fmt.update({'vcodec': 'none', 'acodec': 'aac'})
|
||||||
|
if not is_live:
|
||||||
|
fmt['container'] = 'm4a_dash'
|
||||||
|
|
||||||
participants = ', '.join(traverse_obj(
|
participants = ', '.join(traverse_obj(
|
||||||
space_data, ('participants', 'speakers', ..., 'display_name'))) or 'nobody yet'
|
space_data, ('participants', 'speakers', ..., 'display_name'))) or 'nobody yet'
|
||||||
|
|
Loading…
Reference in a new issue