Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-06-12 09:28:09 +08:00
parent 1c5aa2be40
commit c2ae3cdbba
2 changed files with 21 additions and 16 deletions

View File

@@ -242,24 +242,27 @@ abstract final class VideoHttp {
if (res.data['code'] == 0) {
late PlayUrlModel data;
switch (videoType) {
case VideoType.ugc:
case .ugc:
data = PlayUrlModel.fromJson(res.data['data']);
break;
case VideoType.pugv:
final result = res.data['data'];
data = PlayUrlModel.fromJson(result)
..lastPlayTime =
result?['play_view_business_info']?['user_status']?['watch_progress']?['current_watch_progress'];
break;
case VideoType.pgc:
case .pgc:
final result = res.data['result'];
data = PlayUrlModel.fromJson(result['video_info'])
..lastPlayTime =
result?['play_view_business_info']?['user_status']?['watch_progress']?['current_watch_progress'];
break;
data = PlayUrlModel.fromJson(result['video_info']);
if (result['play_view_business_info']?['user_status']?['watch_progress']?['current_watch_progress']
case final int progress when progress > 0) {
data.lastPlayTime = progress;
}
case .pugv:
final result = res.data['data'];
data = PlayUrlModel.fromJson(result);
if (result['play_view_business_info']?['user_status']?['watch_progress']?['current_watch_progress']
case final int progress when progress > 0) {
data.lastPlayTime = progress;
}
}
return Success(data);
} else if (epid != null && videoType == VideoType.ugc) {
} else if (epid != null && videoType == .ugc) {
return await videoUrl(
avid: avid,
bvid: bvid,
@@ -268,7 +271,7 @@ abstract final class VideoHttp {
epid: epid,
seasonId: seasonId,
tryLook: tryLook,
videoType: VideoType.pgc,
videoType: .pgc,
);
}
return Error(_parseVideoErr(res.data['code'], res.data['message']));

View File

@@ -69,7 +69,9 @@ class PlayUrlModel {
?.map<FormatItem>((e) => FormatItem.fromJson(e))
.toList();
volume = json['volume'] == null ? null : Volume.fromJson(json['volume']);
lastPlayTime = json['last_play_time'];
if (json['last_play_time'] case final int progress when progress > 0) {
lastPlayTime = progress;
}
lastPlayCid = json['last_play_cid'];
curLanguage = json['cur_language'];
language = json['language'] == null