MCPcopy
hub / github.com/AlistGo/alist / getTranscodingLink

Method getTranscodingLink

drivers/quark_uc/util.go:134–162  ·  view source on GitHub ↗
(file model.Obj)

Source from the content-addressed store, hash-verified

132}
133
134func (d *QuarkOrUC) getTranscodingLink(file model.Obj) (*model.Link, error) {
135 data := base.Json{
136 "fid": file.GetID(),
137 "resolutions": "low,normal,high,super,2k,4k",
138 "supports": "fmp4_av,m3u8,dolby_vision",
139 }
140 var resp TranscodingResp
141 ua := d.conf.ua
142
143 _, err := d.request("/file/v2/play/project", http.MethodPost, func(req *resty.Request) {
144 req.SetHeader("User-Agent", ua).
145 SetBody(data)
146 }, &resp)
147 if err != nil {
148 return nil, err
149 }
150
151 for _, info := range resp.Data.VideoList {
152 if info.VideoInfo.URL != "" {
153 return &model.Link{
154 URL: info.VideoInfo.URL,
155 Concurrency: 3,
156 PartSize: 10 * utils.MB,
157 }, nil
158 }
159 }
160
161 return nil, errors.New("no link found")
162}
163
164func (d *QuarkOrUC) upPre(file model.FileStreamer, parentId string) (UpPreResp, error) {
165 now := time.Now()

Callers 1

LinkMethod · 0.95

Calls 3

requestMethod · 0.95
SetHeaderMethod · 0.80
GetIDMethod · 0.65

Tested by

no test coverage detected