alist-org / alist

🗂️A file list/WebDAV program that supports multiple storages, powered by Gin and Solidjs. / 一个支持多存储的文件列表/WebDAV程序,使用 Gin 和 Solidjs。
https://alist.nn.ci
GNU Affero General Public License v3.0
42.44k stars 5.49k forks source link

阿里云盘下载优先使用cdn直链 #6644

Closed qy527145 closed 1 month ago

qy527145 commented 3 months ago

Please make sure of the following things

Description of the feature / 需求描述

鉴于阿里云盘普通用户大幅限速,可以考虑使用阿里的pds服务获取cdn直链来提速

Suggested solution / 实现思路

api参考这里 具体思路如下: 修改下面这个api接口 https://github.com/alist-org/alist/blob/29fe49fb872561df7c73dc89b29ce3e2b359a631/drivers/aliyundrive/driver.go#L109 将请求api从"https://api.alipan.com/v2/file/get_download_url" 修改为:"https://bj29.api.aliyunpds.com/v2/file/get_download_url" 该接口会返回一个cdn_url image 这个链接下载至少10MB/s(我这边路由器原因,瓶颈了) 当然,这个接口有时返回的cdn_url为空(可能是冷门资源,没下载过),但一定会返回一个普通的直链url,业务上可以先尝试获取cdn_url,不行就用普通直链,兼容一下即可

关于cdn直链为空的情况,我这边测试了一下,只要使用普通直链下载一次,再次请求即可拿到cdn_url

Additional context / 附件

No response

ypq123456789 commented 3 months ago

支持,希望能尽快pr合并

qy527145 commented 3 months ago

pr已提,https://github.com/alist-org/alist/pull/6645

stale[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.