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

View File

@@ -69,7 +69,9 @@ class PlayUrlModel {
?.map<FormatItem>((e) => FormatItem.fromJson(e)) ?.map<FormatItem>((e) => FormatItem.fromJson(e))
.toList(); .toList();
volume = json['volume'] == null ? null : Volume.fromJson(json['volume']); 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']; lastPlayCid = json['last_play_cid'];
curLanguage = json['cur_language']; curLanguage = json['cur_language'];
language = json['language'] == null language = json['language'] == null