Skip to content

Commit 8742344

Browse files
authored
fix(doubao_share): use new download info (#1890)
fix(doubao_share): update file URL retrieval to use new download info structure Signed-off-by: MadDogOwner <xiaoran@xrgzs.top>
1 parent 5fe2670 commit 8742344

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

drivers/doubao_share/driver.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,17 @@ func (d *DoubaoShare) Link(ctx context.Context, file model.Obj, args model.LinkA
9292

9393
downloadUrl = r.Data.OriginalMediaInfo.MainURL
9494
default:
95-
var r GetFileUrlResp
96-
_, err := d.request("/alice/message/get_file_url", http.MethodPost, func(req *resty.Request) {
95+
var r GetDownloadInfoResp
96+
_, err := d.request("/samantha/aispace/get_download_info", http.MethodPost, func(req *resty.Request) {
9797
req.SetBody(base.Json{
98-
"uris": []string{u.Key},
99-
"type": FileNodeType[u.NodeType],
98+
"requests": []base.Json{{"node_id": file.GetID()}},
10099
})
101100
}, &r)
102101
if err != nil {
103102
return nil, err
104103
}
105104

106-
downloadUrl = r.Data.FileUrls[0].MainURL
105+
downloadUrl = r.Data.DownloadInfos[0].MainURL
107106
}
108107

109108
// 生成标准的Content-Disposition

drivers/doubao_share/types.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ type FilePath []struct {
115115
UpdateTime int64 `json:"update_time"`
116116
}
117117

118-
type GetFileUrlResp struct {
118+
type GetDownloadInfoResp struct {
119119
BaseResp
120120
Data struct {
121-
FileUrls []struct {
122-
URI string `json:"uri"`
123-
MainURL string `json:"main_url"`
124-
BackURL string `json:"back_url"`
125-
} `json:"file_urls"`
121+
DownloadInfos []struct {
122+
NodeID string `json:"node_id"`
123+
MainURL string `json:"main_url"`
124+
BackupURL string `json:"backup_url"`
125+
} `json:"download_infos"`
126126
} `json:"data"`
127127
}
128128

0 commit comments

Comments
 (0)