aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
authorThe Hatsune Daishi <nao20010128@gmail.com>2021-12-09 20:40:52 +0900
committerGitHub <noreply@github.com>2021-12-09 17:10:52 +0530
commit2814f12ba4dfdcc273935d5991b7e8d2a0434154 (patch)
tree378a749b4f3219e015e5d0fb8fb8f39af747a1e5 /yt_dlp/utils.py
parent1619836cb71ef3f16380ef3a7d93bf61dd482369 (diff)
downloadhypervideo-pre-2814f12ba4dfdcc273935d5991b7e8d2a0434154.tar.lz
hypervideo-pre-2814f12ba4dfdcc273935d5991b7e8d2a0434154.tar.xz
hypervideo-pre-2814f12ba4dfdcc273935d5991b7e8d2a0434154.zip
[skeb] Add extractor (#1916)
Fixes: https://github.com/ytdl-org/youtube-dl/issues/30287 Authored by: nao20010128nao
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r--yt_dlp/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 15cc4d3b2..9d4006051 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -38,6 +38,7 @@ import time
import traceback
import xml.etree.ElementTree
import zlib
+import mimetypes
from .compat import (
compat_HTMLParseError,
@@ -4715,6 +4716,14 @@ def mimetype2ext(mt):
return subtype.replace('+', '.')
+def ext2mimetype(ext_or_url):
+ if not ext_or_url:
+ return None
+ if '.' not in ext_or_url:
+ ext_or_url = f'file.{ext_or_url}'
+ return mimetypes.guess_type(ext_or_url)[0]
+
+
def parse_codecs(codecs_str):
# http://tools.ietf.org/html/rfc6381
if not codecs_str: