mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2025-12-25 20:36:47 +08:00
perf: 调整内置延时机制
This commit is contained in:
parent
af63050292
commit
f2c52cbe89
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: XHS-Downloader 2.6\n"
|
||||
"Project-Id-Version: XHS-Downloader 2.7\n"
|
||||
"Report-Msgid-Bugs-To: <yonglelolu@foxmail.com>\n"
|
||||
"POT-Creation-Date: 2025-08-10 23:34+0800\n"
|
||||
"PO-Revision-Date: 2024-12-22 14:14+0800\n"
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: XHS-Downloader 2.6\n"
|
||||
"Project-Id-Version: XHS-Downloader 2.7\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-08-10 23:34+0800\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: XHS-Downloader 2.6\n"
|
||||
"Project-Id-Version: XHS-Downloader 2.7\n"
|
||||
"Report-Msgid-Bugs-To: <yonglelolu@foxmail.com>\n"
|
||||
"POT-Creation-Date: 2025-08-10 23:34+0800\n"
|
||||
"PO-Revision-Date: 2024-12-22 14:14+0800\n"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "XHS-Downloader"
|
||||
version = "2.6"
|
||||
version = "2.7"
|
||||
description = "小红书(XiaoHongShu、RedNote)链接提取/作品采集工具:提取账号发布、收藏、点赞、专辑作品链接;提取搜索结果作品、用户链接;采集小红书作品信息;提取小红书作品下载地址;下载小红书无水印作品文件"
|
||||
authors = [
|
||||
{ name = "JoeanAmier", email = "yonglelolu@foxmail.com" },
|
||||
|
||||
@ -38,7 +38,7 @@ from source.module import (
|
||||
Manager,
|
||||
MapRecorder,
|
||||
logging,
|
||||
sleep_time,
|
||||
# sleep_time,
|
||||
)
|
||||
from source.translation import _, switch_language
|
||||
|
||||
@ -347,7 +347,7 @@ class XHS:
|
||||
await self.update_author_nickname(data, log)
|
||||
await self.__download_files(data, download, index, log, bar)
|
||||
logging(log, _("作品处理完成:{0}").format(i))
|
||||
await sleep_time()
|
||||
# await sleep_time()
|
||||
return data
|
||||
|
||||
async def update_author_nickname(
|
||||
|
||||
@ -14,7 +14,7 @@ from ..module import (
|
||||
FILE_SIGNATURES_LENGTH,
|
||||
MAX_WORKERS,
|
||||
logging,
|
||||
sleep_time,
|
||||
# sleep_time,
|
||||
)
|
||||
from ..module import retry as re_download
|
||||
from ..translation import _
|
||||
@ -175,8 +175,8 @@ class Download:
|
||||
tasks.append([j[1], file, self.live_format])
|
||||
return tasks
|
||||
|
||||
@staticmethod
|
||||
def __check_exists_glob(
|
||||
self,
|
||||
path: Path,
|
||||
name: str,
|
||||
log,
|
||||
@ -186,8 +186,8 @@ class Download:
|
||||
return True
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def __check_exists_path(
|
||||
self,
|
||||
path: Path,
|
||||
name: str,
|
||||
log,
|
||||
@ -236,7 +236,7 @@ class Download:
|
||||
url,
|
||||
headers=headers,
|
||||
) as response:
|
||||
await sleep_time()
|
||||
# await sleep_time()
|
||||
if response.status_code == 416:
|
||||
raise CacheError(
|
||||
_("文件 {0} 缓存异常,重新下载").format(temp.name),
|
||||
@ -311,11 +311,12 @@ class Download:
|
||||
headers: dict[str, str],
|
||||
suffix: str,
|
||||
) -> tuple[int, str]:
|
||||
"""未使用"""
|
||||
response = await self.client.head(
|
||||
url,
|
||||
headers=headers,
|
||||
)
|
||||
await sleep_time()
|
||||
# await sleep_time()
|
||||
response.raise_for_status()
|
||||
suffix = self.__extract_type(response.headers.get("Content-Type")) or suffix
|
||||
length = response.headers.get("Content-Length", 0)
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
from pathlib import Path
|
||||
|
||||
VERSION_MAJOR = 2
|
||||
VERSION_MINOR = 6
|
||||
VERSION_BETA = False
|
||||
VERSION_MINOR = 7
|
||||
VERSION_BETA = True
|
||||
__VERSION__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{'beta' if VERSION_BETA else 'stable'}"
|
||||
ROOT = Path(__file__).resolve().parent.parent.parent.joinpath("Volume")
|
||||
ROOT.mkdir(exist_ok=True)
|
||||
|
||||
@ -49,7 +49,7 @@ def logging(log, text, style=INFO):
|
||||
|
||||
|
||||
async def sleep_time(
|
||||
min_time: int | float = 1.0,
|
||||
max_time: int | float = 2.5,
|
||||
min_time: int | float = 2.0,
|
||||
max_time: int | float = 4.0,
|
||||
):
|
||||
await sleep(uniform(min_time, max_time))
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
**项目更新内容:**
|
||||
|
||||
1. 调整内置延时机制
|
||||
|
||||
*****
|
||||
|
||||
**用户脚本更新内容:**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user