mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 00:22:34 +01: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_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,9 +1876,13 @@ 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',
|
||||||
|
# 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:
|
for fmt in formats:
|
||||||
fmt.update({'vcodec': 'none', 'acodec': 'aac'})
|
fmt.update({'vcodec': 'none', 'acodec': 'aac'})
|
||||||
if not is_live:
|
if not is_live:
|
||||||
|
Loading…
Reference in New Issue
Block a user