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

下载过程中报错 #7

Open
refat128 opened this issue Jan 18, 2022 · 2 comments
Open

下载过程中报错 #7

refat128 opened this issue Jan 18, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@refat128
Copy link

弹窗
peer closed connection without sending complete message body
然后当前下载任务中止
希望的功能:断点续传,对于已经下载完成的文件校验大小后在判断是不是继续下载。

@laorange
Copy link
Owner

您好

完整的报错信息应该类似于(在帮助-查看日志中可见):
httpx.RemoteProtocolError: peer closed connection without sending complete message body (received 154893472 bytes, expected 296571627)

error20220118160615

我这里在v1.1.x时出现过不少次这个错误,均发生在同时下载大量任务的情况下。

在更新到v1.2.1后,出现该错误的概率减小,但仍然无法从根本上解决该问题。

另外还有httpx.ReadTimeout也是在网络波动时概率性出现的bug。

对于提高同时下载多个视频的稳定性实在有些有心无力。如果出现类似问题。目前只能重试或者每次只下载一集,我尽量在1.3优化这个问题...

如果较大下载需求的话,可以参考另一个基于golang的项目:https://github.com/sodaling/FastestBilibiliDownloader,几个月以前测试的。


另外,当前下载所采用的方法是(/util/my_classes.py VideoDownloader

async with httpx.AsyncClient(headers=headers) as async_downloader:
	with open(self.local_path / video_name, 'wb') as f:
		async with async_downloader.stream('GET', url) as response:
			async for chunk in response.aiter_bytes():
				f.write(chunk)

非计算机相关专业,带着学习的目的和兴趣做的该项目,目前我还没研究过如何断点续传,有待进一步的学习。

如果目前有需要的话可在目前的下载函数上修改(可能有些乱...)

后续如有更新会考虑加入,感谢您的支持与建议!

@laorange
Copy link
Owner

laorange commented May 5, 2022

如果接受命令行下载工具,更推荐使用you-get来下载视频,用pip3 install you-get就能安装上,简单易用🤣

@laorange laorange added the bug Something isn't working label Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants