feat: 直播列表

This commit is contained in:
guozhigq
2023-07-11 17:14:59 +08:00
parent e3c7719a05
commit 75d4e20d99
8 changed files with 455 additions and 11 deletions

View File

@ -185,4 +185,9 @@ class Api {
// vmid 用户id pn 页码 ps 每页个数最大50 order: desc
// order_type 排序规则 最近访问传空,最常访问传 attention
static const String fans = 'https://api.bilibili.com/x/relation/fans';
// 直播
// ?page=1&page_size=30&platform=web
static const String liveList =
'https://api.live.bilibili.com/xlive/web-interface/v1/second/getUserRecommend';
}

25
lib/http/live.dart Normal file
View File

@ -0,0 +1,25 @@
import 'package:pilipala/http/api.dart';
import 'package:pilipala/http/init.dart';
import 'package:pilipala/models/live/item.dart';
class LiveHttp {
static Future liveList(
{int? vmid, int? pn, int? ps, String? orderType}) async {
var res = await Request().get(Api.liveList,
data: {'page': pn, 'page_size': 30, 'platform': 'web'});
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data']['list']
.map<LiveItemModel>((e) => LiveItemModel.fromJson(e))
.toList()
};
} else {
return {
'status': false,
'data': [],
'msg': res.data['message'],
};
}
}
}