From 6ccac1f9b61f8ac764d201d72e57505b040b5cfe Mon Sep 17 00:00:00 2001 From: SherlockNovitch Date: Mon, 8 Jan 2024 13:05:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E6=8F=90=E5=8F=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/application/Downloader.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/application/Downloader.py b/source/application/Downloader.py index 01ac379..1771320 100644 --- a/source/application/Downloader.py +++ b/source/application/Downloader.py @@ -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)