🍲修复异步下载失败率高的问题, fix #496 #502 #503 #505 #506
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
代码中使用了 asyncio.create_task() 来创建并运行异步任务,但是没有等待这些任务完成。这就是为什么当调用 await AwemeDownload() 时,该函数并不会等待所有的 aweme_data 下载完成。
创建了一个任务列表,然后在函数的末尾使用 await asyncio.gather(*tasks) 来等待所有的任务完成。
保证下载完当前页的作品之后再去下载下一页的作品, 避免同时下载好几页的视频, 连接数过多被抖音服务器中断连接.
这个 bug 只影响作品数多的作者, 所以 14000 版本的默认作者"小米粉"是可以正常下载的.