mirror of
https://github.com/awfufu/qbot.git
synced 2026-03-01 05:19:44 +08:00
23 lines
476 B
Go
23 lines
476 B
Go
package api
|
|
|
|
import "encoding/json"
|
|
|
|
func DownloadFile(c Client, url string, threadCount int, headers string) (string, error) {
|
|
params := map[string]any{
|
|
"url": url,
|
|
"thread_count": threadCount,
|
|
"headers": headers,
|
|
}
|
|
data, err := c.SendParams("download_file", params)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
var resp struct {
|
|
File string `json:"file"`
|
|
}
|
|
if err := json.Unmarshal(data, &resp); err != nil {
|
|
return "", err
|
|
}
|
|
return resp.File, nil
|
|
}
|