Skip to content

Commit 736cd9e

Browse files
authored
fix(quark): fix getTranscodingLink (#1136)
The first video info may not contain url * fix(quark): fix getTranscodingLink * fix(quark_tv): fix getTranscodingLink
1 parent c7a603c commit 736cd9e

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

drivers/quark_uc/util.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,18 @@ func (d *QuarkOrUC) getTranscodingLink(file model.Obj) (*model.Link, error) {
149149
return nil, err
150150
}
151151

152-
return &model.Link{
153-
URL: resp.Data.VideoList[0].VideoInfo.URL,
154-
ContentLength: resp.Data.VideoList[0].VideoInfo.Size,
155-
Concurrency: 3,
156-
PartSize: 10 * utils.MB,
157-
}, nil
152+
for _, info := range resp.Data.VideoList {
153+
if info.VideoInfo.URL != "" {
154+
return &model.Link{
155+
URL: info.VideoInfo.URL,
156+
ContentLength: info.VideoInfo.Size,
157+
Concurrency: 3,
158+
PartSize: 10 * utils.MB,
159+
}, nil
160+
}
161+
}
162+
163+
return nil, errors.New("no link found")
158164
}
159165

160166
func (d *QuarkOrUC) upPre(file model.FileStreamer, parentId string) (UpPreResp, error) {

drivers/quark_uc_tv/util.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,18 @@ func (d *QuarkUCTV) getTranscodingLink(ctx context.Context, file model.Obj) (*mo
228228
return nil, err
229229
}
230230

231-
return &model.Link{
232-
URL: fileLink.Data.VideoInfo[0].URL,
233-
Concurrency: 3,
234-
PartSize: 10 * utils.MB,
235-
ContentLength: fileLink.Data.VideoInfo[0].Size,
236-
}, nil
231+
for _, info := range fileLink.Data.VideoInfo {
232+
if info.URL != "" {
233+
return &model.Link{
234+
URL: info.URL,
235+
ContentLength: info.Size,
236+
Concurrency: 3,
237+
PartSize: 10 * utils.MB,
238+
}, nil
239+
}
240+
}
241+
242+
return nil, errors.New("no link found")
237243
}
238244

239245
func (d *QuarkUCTV) getDownloadLink(ctx context.Context, file model.Obj) (*model.Link, error) {

0 commit comments

Comments
 (0)