-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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直链 #6645
base: main
Are you sure you want to change the base?
阿里云盘下载优先使用cdn直链 #6645
Changes from 11 commits
0bb33a8
7b4176c
47fa5c4
fdd4737
77679d1
0f20de2
b7fadfd
3b933c1
196c924
e85a578
164333e
205d85a
78969c0
1ca4f7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,17 +106,26 @@ func (d *AliDrive) Link(ctx context.Context, file model.Obj, args model.LinkArgs | |
"file_id": file.GetID(), | ||
"expire_sec": 14400, | ||
} | ||
res, err, _ := d.request("https://api.alipan.com/v2/file/get_download_url", http.MethodPost, func(req *resty.Request) { | ||
res, err, _ := d.request("https://bj29.api.aliyunpds.com/v2/file/get_download_url", http.MethodPost, func(req *resty.Request) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replacing the official url with a third-party one is never a good practice. Alipan official could change this url anytime, and then many user will have trouble use this driver. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这并不是一个第三方的url,相反,它是阿里云盘的上游服务pds(阿里云的一个云服务产品),阿里云盘在此基础上封装了一层(可能伴随着一些接口信息的阉割),一般来说,它比阿里云盘的接口更可靠。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as long as it's not an official url in the Aliyun-Open doc, it's stability is not guaranteed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 就像 @SeanHeuc 说的,请将其作为一个选项 而不是直接修改 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不太熟悉go语言,回头看看go的语法,有时间再改改 |
||
req.SetBody(data) | ||
}, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
// 尝试获取 cdn_url | ||
cdnURL := utils.Json.Get(res, "cdn_url").ToString() | ||
var downloadURL string | ||
if cdnURL != "" { | ||
downloadURL = cdnURL | ||
} else { | ||
// 如果 cdn_url 为空,则获取 url | ||
downloadURL = utils.Json.Get(res, "url").ToString() | ||
} | ||
return &model.Link{ | ||
Header: http.Header{ | ||
"Referer": []string{"https://www.alipan.com/"}, | ||
}, | ||
URL: utils.Json.Get(res, "url").ToString(), | ||
URL: downloadURL, | ||
}, nil | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请不要修改workflow文件
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我再单独加个分支用于pr吧,好像排除不了了