mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-25 17:38:54 +00:00
Merge remote-tracking branch 'upstream/master' into wait-retries
This commit is contained in:
@@ -685,7 +685,8 @@ def _sanitize_path_parts(parts):
|
||||
elif part == '..':
|
||||
if sanitized_parts and sanitized_parts[-1] != '..':
|
||||
sanitized_parts.pop()
|
||||
sanitized_parts.append('..')
|
||||
else:
|
||||
sanitized_parts.append('..')
|
||||
continue
|
||||
# Replace invalid segments with `#`
|
||||
# - trailing dots and spaces (`asdf...` => `asdf..#`)
|
||||
@@ -702,7 +703,8 @@ def sanitize_path(s, force=False):
|
||||
if not force:
|
||||
return s
|
||||
root = '/' if s.startswith('/') else ''
|
||||
return root + '/'.join(_sanitize_path_parts(s.split('/')))
|
||||
path = '/'.join(_sanitize_path_parts(s.split('/')))
|
||||
return root + path if root or path else '.'
|
||||
|
||||
normed = s.replace('/', '\\')
|
||||
|
||||
@@ -721,7 +723,8 @@ def sanitize_path(s, force=False):
|
||||
root = '\\' if normed[:1] == '\\' else ''
|
||||
parts = normed.split('\\')
|
||||
|
||||
return root + '\\'.join(_sanitize_path_parts(parts))
|
||||
path = '\\'.join(_sanitize_path_parts(parts))
|
||||
return root + path if root or path else '.'
|
||||
|
||||
|
||||
def sanitize_url(url, *, scheme='http'):
|
||||
@@ -5339,7 +5342,7 @@ class FormatSorter:
|
||||
|
||||
settings = {
|
||||
'vcodec': {'type': 'ordered', 'regex': True,
|
||||
'order': ['av0?1', 'vp0?9.0?2', 'vp0?9', '[hx]265|he?vc?', '[hx]264|avc', 'vp0?8', 'mp4v|h263', 'theora', '', None, 'none']},
|
||||
'order': ['av0?1', r'vp0?9\.0?2', 'vp0?9', '[hx]265|he?vc?', '[hx]264|avc', 'vp0?8', 'mp4v|h263', 'theora', '', None, 'none']},
|
||||
'acodec': {'type': 'ordered', 'regex': True,
|
||||
'order': ['[af]lac', 'wav|aiff', 'opus', 'vorbis|ogg', 'aac', 'mp?4a?', 'mp3', 'ac-?4', 'e-?a?c-?3', 'ac-?3', 'dts', '', None, 'none']},
|
||||
'hdr': {'type': 'ordered', 'regex': True, 'field': 'dynamic_range',
|
||||
|
||||
Reference in New Issue
Block a user