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

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

Open
4 tasks done
qy527145 opened this issue Jun 22, 2024 · 2 comments
Open
4 tasks done

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

qy527145 opened this issue Jun 22, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@qy527145
Copy link

Please make sure of the following things

  • I have read the documentation.
  • I'm sure there are no duplicate issues or discussions.
  • I'm sure this feature is not implemented.
  • I'm sure it's a reasonable and popular requirement.

Description of the feature / 需求描述

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

Suggested solution / 实现思路

api参考这里
具体思路如下:
修改下面这个api接口

res, err, _ := d.request("https://api.alipan.com/v2/file/get_download_url", http.MethodPost, func(req *resty.Request) {

将请求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

@qy527145 qy527145 added the enhancement New feature or request label Jun 22, 2024
@ypq123456789
Copy link

支持,希望能尽快pr合并

@qy527145
Copy link
Author

pr已提,#6645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants