The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
修复方法一获取文件时有时候出现的没有正常解码 url编码 的问题;将方法4获取文件名时的时间戳改为ns时间戳,以解决文件名重复的问题(#55)
XiaoYouChR1416946bba29
diff --git a/app/common/methods.py b/app/common/methods.pyindex e022fc4c..85dafb73 100644--- a/app/common/methods.py+++ b/app/common/methods.py@@ -7,7 +7,7 @@ import urllibfrom datetime import datetime, timedelta, timezonefrom email.utils import decode_rfc2231from functools import wraps-from time import sleep, localtime, time+from time import sleep, localtime, time_nsfrom urllib.parse import unquote, parse_qs, urlparseimport httpx@@ -214,6 +214,7 @@ def getLinkInfo(url:str, headers:dict, fileName:str="", verify:bool=False, proxymatch = re.search(r'filename\s*=\s*["\']?([^"\';]+)["\']?', headerValue, re.IGNORECASE)if match:fileName = match.group(1)+ fileName = urllib.parse.unquote(fileName)# 移除文件名头尾可能存在的引号if fileName:@@ -256,7 +257,7 @@ def getLinkInfo(url:str, headers:dict, fileName:str="", verify:bool=False, proxy# 什么都 Get 不到的情况logger.info(f"获取文件名失败, 错误:{e}")content_type = head["content-type"].split('/')[-1]- fileName = f"downloaded_file{int(time())}.{content_type}"+ fileName = f"downloaded_file{int(time_ns())}.{content_type}"logger.debug(f"方法4获取文件名成功, 文件名:{fileName}")return url, fileName, fileSize\ No newline at end of file