feat: 直播弹幕
This commit is contained in:
@ -29,6 +29,7 @@ class Request {
|
||||
late String systemProxyPort;
|
||||
static final RegExp spmPrefixExp =
|
||||
RegExp(r'<meta name="spm_prefix" content="([^"]+?)">');
|
||||
static late String buvid;
|
||||
|
||||
/// 设置cookie
|
||||
static setCookie() async {
|
||||
@ -70,6 +71,8 @@ class Request {
|
||||
final String cookieString = cookie
|
||||
.map((Cookie cookie) => '${cookie.name}=${cookie.value}')
|
||||
.join('; ');
|
||||
|
||||
buvid = cookie.firstWhere((e) => e.name == 'buvid3').value;
|
||||
dio.options.headers['cookie'] = cookieString;
|
||||
}
|
||||
|
||||
|
@ -65,4 +65,23 @@ class LiveHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// 获取弹幕信息
|
||||
static Future liveDanmakuInfo({roomId}) async {
|
||||
var res = await Request().get(Api.getDanmuInfo, data: {
|
||||
'id': roomId,
|
||||
});
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user