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.
功能描述
目前BiliPlus漫画页面的html里不再直接包含图片地址,取而代之的是一些query参数,通过这些参数发起的请求会被重定向到真正的图片地址
例如:
某图片的query参数为:
?act=get_image_url&epid=595701&request_time=1721133361&file=bb35c716a7781be297f57f1e39b21dfc0375e773.jpg&append=
因为
requests
自带重定向功能,带cookie向以下url发送请求https://www.biliplus.com/manga/?act=get_image_url&epid=595701&request_time=1721133361&file=bb35c716a7781be297f57f1e39b21dfc0375e773.jpg&append=
即可得到图片
这个PR将上述的url直接给到
DownloadManager
,不带tokenDownloadManager
通过是否有token判断url是否来自BiliPlus从而分别处理两种下载方式
优劣
优: 使用重定向相当于图片地址解析与下载同时进行,能将下载进度迅速反映在用户界面上
劣: 改动的文件较多,且破坏了
DownloadManager.py
和Episode.py
的抽象在我的网络环境中,无论是否使用重定向,下载的总耗时都差不多
解决这个issue #154