mod: 更新playUrl接口

This commit is contained in:
guozhigq
2024-01-01 15:40:41 +08:00
parent f76ff5fffe
commit fda7a30fd9
2 changed files with 18 additions and 12 deletions

View File

@ -11,7 +11,7 @@ class Api {
// 视频流
// https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/video/videostream_url.md
static const String videoUrl = '/x/player/playurl';
static const String videoUrl = '/x/player/wbi/playurl';
// 视频详情
// 竖屏 https://api.bilibili.com/x/web-interface/view?aid=527403921

View File

@ -122,27 +122,33 @@ class VideoHttp {
static Future videoUrl(
{int? avid, String? bvid, required int cid, int? qn}) async {
Map<String, dynamic> data = {
// 'avid': avid,
'bvid': bvid,
'cid': cid,
// 'qn': qn ?? 80,
'qn': qn ?? 80,
// 获取所有格式的视频
'fnval': 4048,
// 'fnver': '',
'fourk': 1,
// 'session': '',
// 'otype': '',
// 'type': '',
// 'platform': '',
// 'high_quality': ''
};
if (avid != null) {
data['avid'] = avid;
}
if (bvid != null) {
data['bvid'] = bvid;
}
Map params = await WbiSign().makSign({
...data,
'fourk': 1,
'voice_balance': 1,
'gaia_source': 'pre-load',
'web_location': 1550101,
});
// 免登录查看1080p
if (userInfoCache.get('userInfoCache') == null &&
setting.get(SettingBoxKey.p1080, defaultValue: true)) {
data['try_look'] = 1;
}
try {
var res = await Request().get(Api.videoUrl, data: data);
var res = await Request().get(Api.videoUrl, data: params);
if (res.data['code'] == 0) {
return {
'status': true,