diff --git a/lib/common/widgets/video_card_h.dart b/lib/common/widgets/video_card_h.dart index 9ed735e4..5113169d 100644 --- a/lib/common/widgets/video_card_h.dart +++ b/lib/common/widgets/video_card_h.dart @@ -77,6 +77,20 @@ class VideoCardH extends StatelessWidget { SmartDialog.showToast('课堂视频暂不支持播放'); return; } + if (videoItem.pgcLabel?.isNotEmpty == true && + videoItem.redirectUrl?.isNotEmpty == true) { + String? id = RegExp(r'(ep|ss)\d+') + .firstMatch(videoItem.redirectUrl) + ?.group(0); + if (id != null) { + Utils.viewBangumi( + seasonId: + id.startsWith('ss') ? id.replaceFirst('ss', '') : null, + epId: id.startsWith('ep') ? id.replaceFirst('ep', '') : null, + ); + } + return; + } try { final int cid = videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid); @@ -114,6 +128,12 @@ class VideoCardH extends StatelessWidget { width: maxWidth, height: maxHeight, ), + if (videoItem.pgcLabel?.isNotEmpty == true) + PBadge( + text: videoItem.pgcLabel, + top: 6.0, + right: 6.0, + ), if (videoItem.duration != 0) PBadge( text: Utils.timeFormat(videoItem.duration!), diff --git a/lib/models/model_hot_video_item.dart b/lib/models/model_hot_video_item.dart index e9f47560..9416a646 100644 --- a/lib/models/model_hot_video_item.dart +++ b/lib/models/model_hot_video_item.dart @@ -28,6 +28,8 @@ class HotVideoItemModel { this.isOgv, this.rcmdReason, required this.checked, + this.pgcLabel, + this.redirectUrl, }); int? aid; @@ -56,6 +58,8 @@ class HotVideoItemModel { bool? isOgv; RcmdReason? rcmdReason; late bool checked; + String? pgcLabel; + String? redirectUrl; HotVideoItemModel.fromJson(Map json) { aid = json["aid"]; @@ -86,6 +90,8 @@ class HotVideoItemModel { ? RcmdReason.fromJson(json['rcmd_reason']) : null; checked = false; + pgcLabel = json['pgc_label']; + redirectUrl = json['redirect_url']; } } diff --git a/lib/pages/later/controller.dart b/lib/pages/later/controller.dart index 64489a4b..45c61076 100644 --- a/lib/pages/later/controller.dart +++ b/lib/pages/later/controller.dart @@ -171,7 +171,7 @@ class LaterController extends MultiSelectController { List list = List.from( (loadingState.value as Success).response); for (HotVideoItemModel item in list) { - if (item.cid == null) { + if (item.cid == null || item.pgcLabel?.isNotEmpty == true) { continue; } else { if (item.bvid != list.first.bvid) { diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 76a134f8..6529507f 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -401,12 +401,11 @@ class Utils { // epId episode -> progress episode -> first episode EpisodeItem? episode; if (epId != null) { - EpisodeItem? e = (result['data'].episodes as List).firstWhereOrNull( - (item) => item.epId == epId, + episode = (result['data'].episodes as List).firstWhereOrNull( + (item) { + return item.epId.toString() == epId.toString(); + }, ); - if (e != null) { - episode = e; - } } episode ??= (result['data'].episodes as List).firstWhereOrNull( (item) =>