diff --git a/locale/en_GB/LC_MESSAGES/xhs.mo b/locale/en_GB/LC_MESSAGES/xhs.mo index 830c8eb..5de18aa 100644 Binary files a/locale/en_GB/LC_MESSAGES/xhs.mo and b/locale/en_GB/LC_MESSAGES/xhs.mo differ diff --git a/locale/en_GB/LC_MESSAGES/xhs.po b/locale/en_GB/LC_MESSAGES/xhs.po index 2849281..60bec08 100644 --- a/locale/en_GB/LC_MESSAGES/xhs.po +++ b/locale/en_GB/LC_MESSAGES/xhs.po @@ -190,8 +190,11 @@ msgstr "{0} already exists, skipping download" msgid "文件 {0} 下载成功" msgstr "file {0} download successful" -msgid "网络异常,{0} 下载失败" -msgstr "Network error, {0} download failed" +msgid "网络异常,{0} 请求失败,错误信息: {1}" +msgstr "Network error, {0} request failed, error message: {1}" + +msgid "网络异常,{0} 下载失败,错误信息: {1}" +msgstr "Network error, {0} download failed, error message: {1}" msgid "共 {0} 个小红书作品待处理..." msgstr "{0} works from Xiaohongshu are awaiting processing..." diff --git a/locale/zh_CN/LC_MESSAGES/xhs.po b/locale/zh_CN/LC_MESSAGES/xhs.po index a5bf704..70605b1 100644 --- a/locale/zh_CN/LC_MESSAGES/xhs.po +++ b/locale/zh_CN/LC_MESSAGES/xhs.po @@ -190,7 +190,10 @@ msgstr "" msgid "文件 {0} 下载成功" msgstr "" -msgid "网络异常,{0} 下载失败" +msgid "网络异常,{0} 请求失败,错误信息: {1}" +msgstr "" + +msgid "网络异常,{0} 下载失败,错误信息: {1}" msgstr "" msgid "共 {0} 个小红书作品待处理..." diff --git a/source/application/download.py b/source/application/download.py index 22c318b..6c2de15 100644 --- a/source/application/download.py +++ b/source/application/download.py @@ -5,7 +5,7 @@ from typing import TYPE_CHECKING from aiofiles import open from httpx import HTTPError -from source.module import ERROR +from source.module import ERROR, WARNING from source.module import Manager from source.module import logging from source.module import retry as re_download @@ -132,19 +132,22 @@ class Download: try: length, suffix = await self.__head_file(url, headers, format_, ) except HTTPError as error: - logging(log, str(error), ERROR) logging( log, self.message( - "网络异常,{0} 请求失败").format(name), + "网络异常,{0} 请求失败,错误信息: {1}").format(name, error), ERROR, ) + logging( + log, + f"{url} Head Headers: {headers.get("Range")}", + WARNING, + ) return False temp = self.temp.joinpath(f"{name}.{suffix}") real = path.joinpath(f"{name}.{suffix}") self.__update_headers_range(headers, temp, ) try: - # print(f"{url} Stream Headers:", headers.get("Range")) # 调试代码 async with self.client.stream("GET", url, headers=headers, ) as response: response.raise_for_status() # self.__create_progress( @@ -162,15 +165,19 @@ class Download: logging(log, self.message("文件 {0} 下载成功").format(real.name)) return True except HTTPError as error: - self.manager.delete(temp) + # self.manager.delete(temp) # self.__create_progress(bar, None) - logging(log, str(error), ERROR) logging( log, self.message( - "网络异常,{0} 下载失败").format(name), + "网络异常,{0} 下载失败,错误信息: {1}").format(name, error), ERROR, ) + logging( + log, + f"{url} Stream Headers: {headers.get("Range")}", + WARNING, + ) return False @staticmethod @@ -192,7 +199,6 @@ class Download: headers: dict[str, str], suffix: str, ) -> [int, str]: - # print(f"{url} Head Headers:", headers.get("Range")) # 调试代码 response = await self.client.head( url, headers=headers,