mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-08 10:20:37 +00:00
[ie/twitter:spaces] Support video spaces (#10789)
Authored by: bashonly
This commit is contained in:
parent
c8d096c5ce
commit
bef1d4d6fc
@ -1764,7 +1764,7 @@ class TwitterSpacesIE(TwitterBaseIE):
|
||||
'release_timestamp': 1659904215,
|
||||
'release_date': '20220807',
|
||||
},
|
||||
'params': {'skip_download': 'm3u8'},
|
||||
'skip': 'No longer available',
|
||||
}, {
|
||||
# post_live/TimedOut but downloadable
|
||||
'url': 'https://twitter.com/i/spaces/1vAxRAVQWONJl',
|
||||
@ -1780,6 +1780,8 @@ class TwitterSpacesIE(TwitterBaseIE):
|
||||
'upload_date': '20230413',
|
||||
'release_timestamp': 1681839000,
|
||||
'release_date': '20230418',
|
||||
'protocol': 'm3u8', # ffmpeg is forced
|
||||
'container': 'm4a_dash', # audio-only format fixup is applied
|
||||
},
|
||||
'params': {'skip_download': 'm3u8'},
|
||||
}, {
|
||||
@ -1790,11 +1792,31 @@ class TwitterSpacesIE(TwitterBaseIE):
|
||||
'ext': 'm4a',
|
||||
'title': 'あ',
|
||||
'description': 'Twitter Space participated by nobody yet',
|
||||
'uploader': '息根とめる🔪Twitchで復活',
|
||||
'uploader': '息根とめる',
|
||||
'uploader_id': 'tomeru_ikinone',
|
||||
'live_status': 'was_live',
|
||||
'timestamp': 1685617198,
|
||||
'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'},
|
||||
}]
|
||||
@ -1854,13 +1876,17 @@ class TwitterSpacesIE(TwitterBaseIE):
|
||||
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( # XXX: Some Spaces need ffmpeg as downloader
|
||||
source, metadata['media_key'], 'm4a', entry_protocol='m3u8', live=is_live,
|
||||
headers=headers, fatal=False) if source else []
|
||||
for fmt in formats:
|
||||
fmt.update({'vcodec': 'none', 'acodec': 'aac'})
|
||||
if not is_live:
|
||||
fmt['container'] = 'm4a_dash'
|
||||
is_audio_space = source and 'audio-space' in source
|
||||
formats = self._extract_m3u8_formats(
|
||||
source, metadata['media_key'], 'm4a' if is_audio_space else 'mp4',
|
||||
# XXX: Some audio-only Spaces need ffmpeg as downloader
|
||||
entry_protocol='m3u8' if is_audio_space else 'm3u8_native',
|
||||
live=is_live, headers=headers, fatal=False) if source else []
|
||||
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(
|
||||
space_data, ('participants', 'speakers', ..., 'display_name'))) or 'nobody yet'
|
||||
|
Loading…
Reference in New Issue
Block a user