Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

重新下载“下载失败的文件"再次失败好像不会记录这次失败了 #22

Open
luolili233 opened this issue Jul 4, 2024 · 4 comments

Comments

@luolili233
Copy link

luolili233 commented Jul 4, 2024

重新下载上次失败的文件,再次下载失败就直接删除了记录,也没重新下载和记录失败
因为large.kiko-play-niptan.one这个域名的文件会出现下载频率限制,导致后面所有这个域名的文件全部下载失败,而处理下载失败文件的时候还在频率限制内所以继续失败,等下载结束时失败记录就被全清了

@luolili233
Copy link
Author

luolili233 commented Jul 4, 2024

找AI写了个临时解决方案,从日志中提取失败内容储存为failed-download.txt,再重新运行asmr-downloader进行失败文件下载
以下为从日志中提取失败内容的python脚本,请修改path_to_your_log_file.log为自己的日志文件路径

import re

log_file_path = 'path_to_your_log_file.log'
output_file_path = 'failed-download.txt'

unique_results = {}

error_pattern = re.compile(r'下载失败')
line_pattern = re.compile(r'line:\s*(.?)\s"}')
timestamp_pattern = re.compile(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}|')

with open(log_file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()

for i in range(len(lines) - 1):
if error_pattern.search(lines[i]):
next_line = lines[i - 2]
match = line_pattern.search(next_line)
if match:
full_line = match.group(1)
clean_line = timestamp_pattern.sub('', full_line)
if clean_line not in unique_results:
unique_results[clean_line] = full_line

with open(output_file_path, 'w', encoding='utf-8') as file:
for result in unique_results.values():
file.write(result + '\n')

print(f'提取的唯一内容已保存到文件: {output_file_path}')

@fireinrain
Copy link
Owner

我看看哈

@luolili233 luolili233 changed the title 重新下载“载失败的文件"再次失败好像不会记录这次失败了 重新下载“下载失败的文件"再次失败好像不会记录这次失败了 Jul 4, 2024
@luolili233
Copy link
Author

补上large.kiko-play-niptan.one下载频率限制截图,只有这个域名的文件会出现频率限制,其他几个二级域名的暂时没有遇到
QQ截图20240704210225

@fireinrain
Copy link
Owner

谢谢你的测试和反馈 😁我会跟进一下的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants