mod
This commit is contained in:
@ -562,4 +562,37 @@ class Api {
|
||||
/// 系统通知标记已读
|
||||
static const String systemMarkRead =
|
||||
'${HttpString.messageBaseUrl}/x/sys-msg/update_cursor';
|
||||
|
||||
/// 编辑收藏夹
|
||||
static const String editFavFolder = '/x/v3/fav/folder/edit';
|
||||
|
||||
/// 新建收藏夹
|
||||
static const String addFavFolder = '/x/v3/fav/folder/add';
|
||||
|
||||
/// 直播间弹幕信息
|
||||
static const String getDanmuInfo =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/getDanmuInfo';
|
||||
|
||||
/// 直播间发送弹幕
|
||||
static const String sendLiveMsg = '${HttpString.liveBaseUrl}/msg/send';
|
||||
|
||||
/// 我的关注 - 正在直播
|
||||
static const String getFollowingLive =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-ucenter/user/following';
|
||||
|
||||
/// 稍后再看&收藏夹视频列表
|
||||
static const String mediaList = '/x/v2/medialist/resource/list';
|
||||
|
||||
/// 用户专栏
|
||||
static const String opusList = '/x/polymer/web-dynamic/v1/opus/feed/space';
|
||||
|
||||
///
|
||||
static const String getViewInfo = '/x/article/viewinfo';
|
||||
|
||||
/// 直播间记录
|
||||
static const String liveRoomEntry =
|
||||
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/roomEntryAction';
|
||||
|
||||
/// 删除评论
|
||||
static const String replyDel = '/x/v2/reply/del';
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ class HttpString {
|
||||
static const String liveBaseUrl = 'https://api.live.bilibili.com';
|
||||
static const String passBaseUrl = 'https://passport.bilibili.com';
|
||||
static const String messageBaseUrl = 'https://message.bilibili.com';
|
||||
static const String bangumiBaseUrl = 'https://bili.meark.me';
|
||||
static const List<int> validateStatusCodes = [
|
||||
302,
|
||||
304,
|
||||
|
@ -70,7 +70,7 @@ class HtmlHttp {
|
||||
static Future reqReadHtml(id, dynamicType) async {
|
||||
var response = await Request().get(
|
||||
"https://www.bilibili.com/$dynamicType/$id/",
|
||||
extra: {'ua': 'pc', 'opus-goback': '1'},
|
||||
extra: {'ua': 'pc'},
|
||||
);
|
||||
Document rootTree = parse(response.data);
|
||||
Element body = rootTree.body!;
|
||||
|
@ -226,15 +226,6 @@ class Request {
|
||||
if (extra['ua'] != null) {
|
||||
options.headers = {'user-agent': headerUa(type: extra['ua'])};
|
||||
}
|
||||
if (extra['opus-goback'] != null) {
|
||||
List<Cookie> cookies = await cookieManager.cookieJar
|
||||
.loadForRequest(Uri.parse(HttpString.baseUrl));
|
||||
String cookieHeader = cookies
|
||||
.map((cookie) => '${cookie.name}=${cookie.value}')
|
||||
.join('; ');
|
||||
options.headers!['cookie'] =
|
||||
'$cookieHeader; opus-goback = ${extra['opus-goback']}';
|
||||
}
|
||||
}
|
||||
options.responseType = resType;
|
||||
|
||||
|
@ -145,4 +145,18 @@ class LiveHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 直播历史记录
|
||||
static Future liveRoomEntry({required int roomId}) async {
|
||||
await Request().post(
|
||||
Api.liveRoomEntry,
|
||||
data: {
|
||||
'room_id': roomId,
|
||||
'platform': 'pc',
|
||||
'csrf_token': await Request.getCsrf(),
|
||||
'csrf': await Request.getCsrf(),
|
||||
'visit_id': '',
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -703,43 +703,3 @@ class Vip {
|
||||
status = json['status'];
|
||||
}
|
||||
}
|
||||
|
||||
class Staff {
|
||||
Staff({
|
||||
this.mid,
|
||||
this.title,
|
||||
this.name,
|
||||
this.face,
|
||||
this.vip,
|
||||
});
|
||||
|
||||
int? mid;
|
||||
String? title;
|
||||
String? name;
|
||||
String? face;
|
||||
int? status;
|
||||
Vip? vip;
|
||||
|
||||
Staff.fromJson(Map<String, dynamic> json) {
|
||||
mid = json['mid'];
|
||||
title = json['title'];
|
||||
name = json['name'];
|
||||
face = json['face'];
|
||||
vip = Vip.fromJson(json['vip']);
|
||||
}
|
||||
}
|
||||
|
||||
class Vip {
|
||||
Vip({
|
||||
this.type,
|
||||
this.status,
|
||||
});
|
||||
|
||||
int? type;
|
||||
int? status;
|
||||
|
||||
Vip.fromJson(Map<String, dynamic> json) {
|
||||
type = json['type'];
|
||||
status = json['status'];
|
||||
}
|
||||
}
|
||||
|
@ -132,4 +132,22 @@ class FavDetailController extends GetxController {
|
||||
title.value = res['title'];
|
||||
print(title);
|
||||
}
|
||||
|
||||
Future toViewPlayAll() async {
|
||||
final FavDetailItemData firstItem = favList.first;
|
||||
final String heroTag = Utils.makeHeroTag(firstItem.bvid);
|
||||
Get.toNamed(
|
||||
'/video?bvid=${firstItem.bvid}&cid=${firstItem.cid}',
|
||||
arguments: {
|
||||
'videoItem': firstItem,
|
||||
'heroTag': heroTag,
|
||||
'sourceType': 'fav',
|
||||
'mediaId': favInfo['id'],
|
||||
'oid': firstItem.id,
|
||||
'favTitle': favInfo['title'],
|
||||
'favInfo': favInfo,
|
||||
'count': favInfo['media_count'],
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -668,11 +668,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
tag: heroTag,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
if (isShowing)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: videoPlayerPanel,
|
||||
),
|
||||
Obx(
|
||||
() => isShowing.value
|
||||
? buildVideoPlayerPanel()
|
||||
: const SizedBox(),
|
||||
),
|
||||
|
||||
/// 关闭自动播放时 手动播放
|
||||
Obx(
|
||||
|
@ -366,13 +366,7 @@ class PlPlayerController {
|
||||
}
|
||||
// 配置Player 音轨、字幕等等
|
||||
_videoPlayerController = await _createVideoController(
|
||||
dataSource,
|
||||
_looping,
|
||||
enableHA,
|
||||
width,
|
||||
height,
|
||||
seekTo,
|
||||
);
|
||||
dataSource, _looping, enableHA, width, height, seekTo);
|
||||
// 获取视频时长 00:00
|
||||
_duration.value = duration ?? _videoPlayerController!.state.duration;
|
||||
updateDurationSecond();
|
||||
@ -403,7 +397,7 @@ class PlPlayerController {
|
||||
bool enableHA,
|
||||
double? width,
|
||||
double? height,
|
||||
Duration? seekTo,
|
||||
Duration seekTo,
|
||||
) async {
|
||||
// 每次配置时先移除监听
|
||||
removeListeners();
|
||||
@ -491,12 +485,9 @@ class PlPlayerController {
|
||||
play: false,
|
||||
);
|
||||
}
|
||||
player.open(
|
||||
Media(
|
||||
dataSource.videoSource!,
|
||||
httpHeaders: dataSource.httpHeaders,
|
||||
start: seekTo ?? Duration.zero,
|
||||
),
|
||||
await player.open(
|
||||
Media(dataSource.videoSource!,
|
||||
httpHeaders: dataSource.httpHeaders, start: seekTo),
|
||||
play: false,
|
||||
);
|
||||
// 音轨
|
||||
@ -536,15 +527,6 @@ class PlPlayerController {
|
||||
await setPlaybackSpeed(1.0);
|
||||
}
|
||||
}
|
||||
getVideoFit();
|
||||
// if (_looping) {
|
||||
// await setLooping(_looping);
|
||||
// }
|
||||
|
||||
// 自动播放
|
||||
if (_autoPlay) {
|
||||
await play(duration: duration);
|
||||
}
|
||||
}
|
||||
|
||||
List<StreamSubscription> subscriptions = [];
|
||||
|
@ -193,6 +193,9 @@ class Routes {
|
||||
// 专栏
|
||||
CustomGetPage(name: '/opus', page: () => const OpusPage()),
|
||||
CustomGetPage(name: '/read', page: () => const ReadPage()),
|
||||
// 用户专栏
|
||||
CustomGetPage(
|
||||
name: '/memberArticle', page: () => const MemberArticlePage()),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -226,21 +226,6 @@ class Utils {
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
// 向上查找
|
||||
if (closestNumber == 0) {
|
||||
try {
|
||||
for (int number in numbers) {
|
||||
int diff = (number - target).abs();
|
||||
|
||||
if (diff < minDiff) {
|
||||
minDiff = diff;
|
||||
closestNumber = number;
|
||||
return closestNumber;
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
// 向上查找
|
||||
if (closestNumber == 0) {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user