优化文件格式提取逻辑

This commit is contained in:
SherlockNovitch
2024-01-08 13:05:46 +08:00
committed by yongquan
parent d364e32473
commit 6ccac1f9b6

View File

@@ -11,6 +11,9 @@ __all__ = ['Download']
class Download:
CONTENT_TYPE_MAP = {
"quicktime": "mov",
}
def __init__(self, manager: Manager, ):
self.manager = manager
@@ -82,7 +85,7 @@ class Download:
if bar:
bar.advance(advance)
@staticmethod
def __extract_type(content: str) -> str:
return "" if content == "application/octet-stream" else content.split(
"/")[-1]
@classmethod
def __extract_type(cls, content: str) -> str:
return "" if content == "application/octet-stream" else cls.CONTENT_TYPE_MAP.get(
s := content.split("/")[-1], s)