fix:(baidu_photo): upload erron -6 (#7760 close #7744)

* fix:(baidu_photo): upload erron -6

* fix(baidu_photo):api add bdstoken
This commit is contained in:
foxxorcat
2025-01-01 21:13:34 +08:00
committed by GitHub
parent 7fd4ac7851
commit e4439e66b9
2 changed files with 25 additions and 3 deletions

View File

@ -476,6 +476,21 @@ func (d *BaiduPhoto) uInfo() (*UInfo, error) {
return &info, nil
}
func (d *BaiduPhoto) getBDStoken() (string, error) {
var info struct {
Result struct {
Bdstoken string `json:"bdstoken"`
Token string `json:"token"`
Uk int64 `json:"uk"`
} `json:"result"`
}
_, err := d.Get("https://pan.baidu.com/api/gettemplatevariable?fields=[%22bdstoken%22,%22token%22,%22uk%22]", nil, &info)
if err != nil {
return "", err
}
return info.Result.Bdstoken, nil
}
func DecryptMd5(encryptMd5 string) string {
if _, err := hex.DecodeString(encryptMd5); err == nil {
return encryptMd5