mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-09 22:39:32 +01:00
[vimeo] improve format extraction and sorting(closes #25285)
This commit is contained in:
parent
b334732709
commit
52c50a10af
@ -140,28 +140,28 @@ def _parse_config(self, config, video_id):
|
|||||||
})
|
})
|
||||||
|
|
||||||
# TODO: fix handling of 308 status code returned for live archive manifest requests
|
# TODO: fix handling of 308 status code returned for live archive manifest requests
|
||||||
|
sep_pattern = r'/sep/video/'
|
||||||
for files_type in ('hls', 'dash'):
|
for files_type in ('hls', 'dash'):
|
||||||
for cdn_name, cdn_data in config_files.get(files_type, {}).get('cdns', {}).items():
|
for cdn_name, cdn_data in config_files.get(files_type, {}).get('cdns', {}).items():
|
||||||
manifest_url = cdn_data.get('url')
|
manifest_url = cdn_data.get('url')
|
||||||
if not manifest_url:
|
if not manifest_url:
|
||||||
continue
|
continue
|
||||||
format_id = '%s-%s' % (files_type, cdn_name)
|
format_id = '%s-%s' % (files_type, cdn_name)
|
||||||
if files_type == 'hls':
|
sep_manifest_urls = []
|
||||||
formats.extend(self._extract_m3u8_formats(
|
if re.search(sep_pattern, manifest_url):
|
||||||
manifest_url, video_id, 'mp4',
|
for suffix, repl in (('', 'video'), ('_sep', 'sep/video')):
|
||||||
'm3u8' if is_live else 'm3u8_native', m3u8_id=format_id,
|
sep_manifest_urls.append((format_id + suffix, re.sub(
|
||||||
note='Downloading %s m3u8 information' % cdn_name,
|
sep_pattern, '/%s/' % repl, manifest_url)))
|
||||||
fatal=False))
|
else:
|
||||||
elif files_type == 'dash':
|
sep_manifest_urls = [(format_id, manifest_url)]
|
||||||
mpd_pattern = r'/%s/(?:sep/)?video/' % video_id
|
for f_id, m_url in sep_manifest_urls:
|
||||||
mpd_manifest_urls = []
|
if files_type == 'hls':
|
||||||
if re.search(mpd_pattern, manifest_url):
|
formats.extend(self._extract_m3u8_formats(
|
||||||
for suffix, repl in (('', 'video'), ('_sep', 'sep/video')):
|
m_url, video_id, 'mp4',
|
||||||
mpd_manifest_urls.append((format_id + suffix, re.sub(
|
'm3u8' if is_live else 'm3u8_native', m3u8_id=f_id,
|
||||||
mpd_pattern, '/%s/%s/' % (video_id, repl), manifest_url)))
|
note='Downloading %s m3u8 information' % cdn_name,
|
||||||
else:
|
fatal=False))
|
||||||
mpd_manifest_urls = [(format_id, manifest_url)]
|
elif files_type == 'dash':
|
||||||
for f_id, m_url in mpd_manifest_urls:
|
|
||||||
if 'json=1' in m_url:
|
if 'json=1' in m_url:
|
||||||
real_m_url = (self._download_json(m_url, video_id, fatal=False) or {}).get('url')
|
real_m_url = (self._download_json(m_url, video_id, fatal=False) or {}).get('url')
|
||||||
if real_m_url:
|
if real_m_url:
|
||||||
@ -170,11 +170,6 @@ def _parse_config(self, config, video_id):
|
|||||||
m_url.replace('/master.json', '/master.mpd'), video_id, f_id,
|
m_url.replace('/master.json', '/master.mpd'), video_id, f_id,
|
||||||
'Downloading %s MPD information' % cdn_name,
|
'Downloading %s MPD information' % cdn_name,
|
||||||
fatal=False)
|
fatal=False)
|
||||||
for f in mpd_formats:
|
|
||||||
if f.get('vcodec') == 'none':
|
|
||||||
f['preference'] = -50
|
|
||||||
elif f.get('acodec') == 'none':
|
|
||||||
f['preference'] = -40
|
|
||||||
formats.extend(mpd_formats)
|
formats.extend(mpd_formats)
|
||||||
|
|
||||||
live_archive = live_event.get('archive') or {}
|
live_archive = live_event.get('archive') or {}
|
||||||
@ -186,6 +181,12 @@ def _parse_config(self, config, video_id):
|
|||||||
'preference': 1,
|
'preference': 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
for f in formats:
|
||||||
|
if f.get('vcodec') == 'none':
|
||||||
|
f['preference'] = -50
|
||||||
|
elif f.get('acodec') == 'none':
|
||||||
|
f['preference'] = -40
|
||||||
|
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
text_tracks = config['request'].get('text_tracks')
|
text_tracks = config['request'].get('text_tracks')
|
||||||
if text_tracks:
|
if text_tracks:
|
||||||
|
Loading…
Reference in New Issue
Block a user