fix: rcmd data parse

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-26 22:21:32 +08:00
parent 91389f91d1
commit c591b57f22

View File

@@ -12,20 +12,14 @@ class RecVideoItemAppModel extends BaseRecVideoItemModel {
ThreePoint? threePoint; ThreePoint? threePoint;
RecVideoItemAppModel.fromJson(Map<String, dynamic> json) { RecVideoItemAppModel.fromJson(Map<String, dynamic> json) {
id = json['player_args'] != null id = json['player_args']?['aid'] ?? int.tryParse(json['param'] ?? '0');
? json['player_args']['aid']
: int.tryParse(json['param'] ?? '-1');
aid = id; aid = id;
bvid = json['bvid'] ?? bvid = json['bvid'] ?? IdUtils.av2bv(id!);
(json['player_args'] != null cid = json['player_args']?['cid'] ?? 0;
? IdUtils.av2bv(json['player_args']['aid'])
: '');
cid = json['player_args'] != null ? json['player_args']['cid'] : -1;
pic = json['cover']; pic = json['cover'];
stat = RcmdStat.fromJson(json); stat = RcmdStat.fromJson(json);
// 改用player_args中的duration作为原始数据秒数 // 改用player_args中的duration作为原始数据秒数
duration = duration = json['player_args']?['duration'] ?? 0;
json['player_args'] != null ? json['player_args']['duration'] : -1;
//duration = json['cover_right_text']; //duration = json['cover_right_text'];
title = json['title']; title = json['title'];
owner = RcmdOwner.fromJson(json); owner = RcmdOwner.fromJson(json);
@@ -91,11 +85,9 @@ class RcmdStat implements BaseStat {
class RcmdOwner extends BaseOwner { class RcmdOwner extends BaseOwner {
RcmdOwner.fromJson(Map<String, dynamic> json) { RcmdOwner.fromJson(Map<String, dynamic> json) {
name = json['goto'] == 'av' name = json['goto'] == 'av'
? json['args']['up_name'] ? (json['args']?['up_name'])
: json['desc_button'] != null : (json['desc_button']?['text'] ?? '');
? json['desc_button']['text'] mid = json['args']?['up_id'] ?? 0;
: '';
mid = json['args']['up_id'] ?? -1;
} }
} }