summaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils/_utils.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:06:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:06:48 +0000
commitdeb9c3cdb096ee4aa1cd29cdd249cd40bdff73e8 (patch)
tree28cdb51427d366c5e840a4a364c6fc078da925af /yt_dlp/utils/_utils.py
parentReleasing progress-linux version 2024.07.02-1~progress7.99u1. (diff)
downloadyt-dlp-deb9c3cdb096ee4aa1cd29cdd249cd40bdff73e8.tar.xz
yt-dlp-deb9c3cdb096ee4aa1cd29cdd249cd40bdff73e8.zip
Merging upstream version 2024.07.07.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/utils/_utils.py')
-rw-r--r--yt_dlp/utils/_utils.py42
1 files changed, 38 insertions, 4 deletions
diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py
index b5e1e29..b582b7d 100644
--- a/yt_dlp/utils/_utils.py
+++ b/yt_dlp/utils/_utils.py
@@ -5026,7 +5026,7 @@ MEDIA_EXTENSIONS = Namespace(
common_video=('avi', 'flv', 'mkv', 'mov', 'mp4', 'webm'),
video=('3g2', '3gp', 'f4v', 'mk3d', 'divx', 'mpg', 'ogv', 'm4v', 'wmv'),
common_audio=('aiff', 'alac', 'flac', 'm4a', 'mka', 'mp3', 'ogg', 'opus', 'wav'),
- audio=('aac', 'ape', 'asf', 'f4a', 'f4b', 'm4b', 'm4p', 'm4r', 'oga', 'ogx', 'spx', 'vorbis', 'wma', 'weba'),
+ audio=('aac', 'ape', 'asf', 'f4a', 'f4b', 'm4b', 'm4r', 'oga', 'ogx', 'spx', 'vorbis', 'wma', 'weba'),
thumbnails=('jpg', 'png', 'webp'),
storyboards=('mhtml', ),
subtitles=('srt', 'vtt', 'ass', 'lrc'),
@@ -5059,27 +5059,53 @@ class _UnsafeExtensionError(Exception):
# video
*MEDIA_EXTENSIONS.video,
- 'avif',
+ 'asx',
'ismv',
+ 'm2t',
'm2ts',
+ 'm2v',
'm4s',
'mng',
+ 'mp2v',
+ 'mp4v',
+ 'mpe',
'mpeg',
+ 'mpeg1',
+ 'mpeg2',
+ 'mpeg4',
+ 'mxf',
+ 'ogm',
'qt',
+ 'rm',
'swf',
'ts',
+ 'vob',
'vp9',
- 'wvm',
# audio
*MEDIA_EXTENSIONS.audio,
+ '3ga',
+ 'ac3',
+ 'adts',
+ 'aif',
+ 'au',
+ 'dts',
'isma',
+ 'it',
'mid',
+ 'mod',
'mpga',
+ 'mp1',
+ 'mp2',
+ 'mp4a',
+ 'mpa',
'ra',
+ 'shn',
+ 'xm',
# image
*MEDIA_EXTENSIONS.thumbnails,
+ 'avif',
'bmp',
'gif',
'heic',
@@ -5089,6 +5115,7 @@ class _UnsafeExtensionError(Exception):
'jxl',
'svg',
'tif',
+ 'tiff',
'wbmp',
# subtitle
@@ -5096,11 +5123,16 @@ class _UnsafeExtensionError(Exception):
'dfxp',
'fs',
'ismt',
+ 'json3',
'sami',
'scc',
+ 'srv1',
+ 'srv2',
+ 'srv3',
'ssa',
'tt',
'ttml',
+ 'xml',
# others
*MEDIA_EXTENSIONS.manifests,
@@ -5111,7 +5143,6 @@ class _UnsafeExtensionError(Exception):
'sbv',
'url',
'webloc',
- 'xml',
])
def __init__(self, extension, /):
@@ -5120,6 +5151,9 @@ class _UnsafeExtensionError(Exception):
@classmethod
def sanitize_extension(cls, extension, /, *, prepend=False):
+ if extension is None:
+ return None
+
if '/' in extension or '\\' in extension:
raise cls(extension)