fireinrain / asmr-downloader

A tool for download asmr media from asmr.one(Thanks for the asmr.one)
MIT License
72 stars 6 forks source link

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

Open luoli233 opened 3 months ago

luoli233 commented 3 months ago

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

luoli233 commented 3 months ago

找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 commented 3 months ago

我看看哈

luoli233 commented 3 months ago

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

fireinrain commented 3 months ago

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