mod: 收藏夹跳转番剧
This commit is contained in:
@ -69,7 +69,8 @@ class UserHttp {
|
|||||||
'keyword': keyword,
|
'keyword': keyword,
|
||||||
'order': order,
|
'order': order,
|
||||||
'type': 0,
|
'type': 0,
|
||||||
'tid': 0
|
'tid': 0,
|
||||||
|
'platform': 'web'
|
||||||
});
|
});
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
FavDetailData data = FavDetailData.fromJson(res.data['data']);
|
FavDetailData data = FavDetailData.fromJson(res.data['data']);
|
||||||
|
|||||||
@ -41,9 +41,10 @@ class FavDetailItemData {
|
|||||||
this.bvId,
|
this.bvId,
|
||||||
this.bvid,
|
this.bvid,
|
||||||
// this.season,
|
// this.season,
|
||||||
// this.ogv,
|
this.ogv,
|
||||||
this.stat,
|
this.stat,
|
||||||
this.cid,
|
this.cid,
|
||||||
|
this.epId,
|
||||||
});
|
});
|
||||||
|
|
||||||
int? id;
|
int? id;
|
||||||
@ -62,8 +63,10 @@ class FavDetailItemData {
|
|||||||
int? favTime;
|
int? favTime;
|
||||||
String? bvId;
|
String? bvId;
|
||||||
String? bvid;
|
String? bvid;
|
||||||
|
Map? ogv;
|
||||||
Stat? stat;
|
Stat? stat;
|
||||||
int? cid;
|
int? cid;
|
||||||
|
String? epId;
|
||||||
|
|
||||||
FavDetailItemData.fromJson(Map<String, dynamic> json) {
|
FavDetailItemData.fromJson(Map<String, dynamic> json) {
|
||||||
id = json['id'];
|
id = json['id'];
|
||||||
@ -82,8 +85,22 @@ class FavDetailItemData {
|
|||||||
favTime = json['fav_time'];
|
favTime = json['fav_time'];
|
||||||
bvId = json['bv_id'];
|
bvId = json['bv_id'];
|
||||||
bvid = json['bvid'];
|
bvid = json['bvid'];
|
||||||
|
ogv = json['ogv'];
|
||||||
stat = Stat.fromJson(json['cnt_info']);
|
stat = Stat.fromJson(json['cnt_info']);
|
||||||
cid = json['ugc']['first_cid'];
|
cid = json['ugc'] != null ? json['ugc']['first_cid'] : null;
|
||||||
|
if (json['link'] != null && json['link'].contains('/bangumi')) {
|
||||||
|
epId = resolveEpId(json['link']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String resolveEpId(url) {
|
||||||
|
RegExp regex = RegExp(r'\d+');
|
||||||
|
Iterable<Match> matches = regex.allMatches(url);
|
||||||
|
List<String> numbers = [];
|
||||||
|
for (Match match in matches) {
|
||||||
|
numbers.add(match.group(0)!);
|
||||||
|
}
|
||||||
|
return numbers[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -153,16 +153,20 @@ class VideoDetailData {
|
|||||||
likeIcon = json["like_icon"];
|
likeIcon = json["like_icon"];
|
||||||
needJumpBv = json["need_jump_bv"];
|
needJumpBv = json["need_jump_bv"];
|
||||||
if (json['redirect_url'] != null) {
|
if (json['redirect_url'] != null) {
|
||||||
RegExp regex = RegExp(r'\d+');
|
epId = resolveEpId(json['redirect_url']);
|
||||||
Iterable<Match> matches = regex.allMatches(json['redirect_url']);
|
|
||||||
List<String> numbers = [];
|
|
||||||
for (Match match in matches) {
|
|
||||||
numbers.add(match.group(0)!);
|
|
||||||
}
|
|
||||||
epId = numbers[0];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String resolveEpId(url) {
|
||||||
|
RegExp regex = RegExp(r'\d+');
|
||||||
|
Iterable<Match> matches = regex.allMatches(url);
|
||||||
|
List<String> numbers = [];
|
||||||
|
for (Match match in matches) {
|
||||||
|
numbers.add(match.group(0)!);
|
||||||
|
}
|
||||||
|
return numbers[0];
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"bvid": bvid,
|
"bvid": bvid,
|
||||||
"aid": aid,
|
"aid": aid,
|
||||||
|
|||||||
@ -3,6 +3,9 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
|
import 'package:pilipala/http/search.dart';
|
||||||
|
import 'package:pilipala/http/video.dart';
|
||||||
|
import 'package:pilipala/models/common/search_type.dart';
|
||||||
import 'package:pilipala/utils/id_utils.dart';
|
import 'package:pilipala/utils/id_utils.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
import 'package:pilipala/common/widgets/network_img_layer.dart';
|
||||||
@ -20,7 +23,7 @@ class FavVideoCardH extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
int id = videoItem.id;
|
int id = videoItem.id;
|
||||||
String bvid = IdUtils.av2bv(id);
|
String bvid = videoItem.bvid ?? IdUtils.av2bv(id);
|
||||||
String heroTag = Utils.makeHeroTag(id);
|
String heroTag = Utils.makeHeroTag(id);
|
||||||
return Dismissible(
|
return Dismissible(
|
||||||
movementDuration: const Duration(milliseconds: 300),
|
movementDuration: const Duration(milliseconds: 300),
|
||||||
@ -44,9 +47,33 @@ class FavVideoCardH extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await Future.delayed(const Duration(milliseconds: 200));
|
// int? seasonId;
|
||||||
Get.toNamed('/video?bvid=$bvid&cid=${videoItem.cid}',
|
String? epId;
|
||||||
arguments: {'videoItem': videoItem, 'heroTag': heroTag});
|
if (videoItem.ogv != null && videoItem.ogv['type_name'] == '番剧') {
|
||||||
|
videoItem.cid = await SearchHttp.ab2c(bvid: bvid);
|
||||||
|
// seasonId = videoItem.ogv['season_id'];
|
||||||
|
epId = videoItem.epId;
|
||||||
|
} else if (videoItem.page == 0 || videoItem.page > 1) {
|
||||||
|
var result = await VideoHttp.videoIntro(bvid: bvid);
|
||||||
|
if (result['status']) {
|
||||||
|
epId = result['data'].epId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> parameters = {
|
||||||
|
'bvid': bvid,
|
||||||
|
'cid': videoItem.cid.toString(),
|
||||||
|
'epId': epId ?? '',
|
||||||
|
};
|
||||||
|
// if (seasonId != null) {
|
||||||
|
// parameters['seasonId'] = seasonId.toString();
|
||||||
|
// }
|
||||||
|
Get.toNamed('/video', parameters: parameters, arguments: {
|
||||||
|
'videoItem': videoItem,
|
||||||
|
'heroTag': heroTag,
|
||||||
|
'videoType':
|
||||||
|
epId != null ? SearchType.media_bangumi : SearchType.video,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
Reference in New Issue
Block a user