mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-22 02:03:58 +08:00
opt: live api
This commit is contained in:
@@ -398,27 +398,6 @@ class Api {
|
||||
|
||||
static const String pgcUpdate = '/pgc/web/follow/status/update';
|
||||
|
||||
// 番剧列表
|
||||
// https://api.bilibili.com/pgc/season/index/result?
|
||||
// st=1&
|
||||
// order=3
|
||||
// season_version=-1 全部-1 正片1 电影2 其他3
|
||||
// spoken_language_type=-1 全部-1 原生1 中文配音2
|
||||
// area=-1&
|
||||
// is_finish=-1&
|
||||
// copyright=-1&
|
||||
// season_status=-1&
|
||||
// season_month=-1&
|
||||
// year=-1&
|
||||
// style_id=-1&
|
||||
// sort=0&
|
||||
// page=1&
|
||||
// season_type=1&
|
||||
// pagesize=20&
|
||||
// type=1
|
||||
static const String pgcIndex =
|
||||
'/pgc/season/index/result?st=1&order=3&season_version=-1&spoken_language_type=-1&area=-1&is_finish=-1©right=-1&season_status=-1&season_month=-1&year=-1&style_id=-1&sort=0&season_type=1&pagesize=20&type=1';
|
||||
|
||||
// 我的追番/追剧 ?type=1&pn=1&ps=15
|
||||
static const String favPgc = '/x/space/bangumi/follow/list';
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:PiliPlus/http/init.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/login.dart';
|
||||
import 'package:PiliPlus/http/ua_type.dart';
|
||||
import 'package:PiliPlus/models/common/account_type.dart';
|
||||
import 'package:PiliPlus/models/common/live_search_type.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_area_list/area_item.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_area_list/area_list.dart';
|
||||
@@ -20,12 +21,20 @@ import 'package:PiliPlus/models_new/live/live_search/data.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_second_list/data.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_superchat/data.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/accounts/account.dart';
|
||||
import 'package:PiliPlus/utils/app_sign.dart';
|
||||
import 'package:PiliPlus/utils/wbi_sign.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class LiveHttp {
|
||||
static Future sendLiveMsg({roomId, msg, dmType, emoticonOptions}) async {
|
||||
abstract final class LiveHttp {
|
||||
static Account get recommend => Accounts.get(AccountType.recommend);
|
||||
|
||||
static Future sendLiveMsg({
|
||||
required Object roomId,
|
||||
required Object msg,
|
||||
Object? dmType,
|
||||
Object? emoticonOptions,
|
||||
}) async {
|
||||
String csrf = Accounts.main.csrf;
|
||||
var res = await Request().post(
|
||||
Api.sendLiveMsg,
|
||||
@@ -165,11 +174,10 @@ class LiveHttp {
|
||||
|
||||
static Future<LoadingState<LiveIndexData>> liveFeedIndex({
|
||||
required int pn,
|
||||
required bool isLogin,
|
||||
bool moduleSelect = false,
|
||||
}) async {
|
||||
final params = {
|
||||
'access_key': ?Accounts.main.accessKey,
|
||||
'access_key': ?recommend.accessKey,
|
||||
'appkey': Constants.appKey,
|
||||
'channel': 'master',
|
||||
'actionKey': 'appkey',
|
||||
@@ -187,7 +195,7 @@ class LiveHttp {
|
||||
'network': 'wifi',
|
||||
'page': pn,
|
||||
'platform': 'android',
|
||||
if (isLogin) 'relation_page': 1,
|
||||
if (recommend.isLogin) 'relation_page': 1,
|
||||
's_locale': 'zh_CN',
|
||||
'scale': 2,
|
||||
'statistics': Constants.statisticsApp,
|
||||
@@ -245,13 +253,12 @@ class LiveHttp {
|
||||
|
||||
static Future<LoadingState<LiveSecondData>> liveSecondList({
|
||||
required int pn,
|
||||
required bool isLogin,
|
||||
required areaId,
|
||||
required parentAreaId,
|
||||
required Object? areaId,
|
||||
required Object? parentAreaId,
|
||||
String? sortType,
|
||||
}) async {
|
||||
final params = {
|
||||
'access_key': ?Accounts.main.accessKey,
|
||||
'access_key': ?recommend.accessKey,
|
||||
'appkey': Constants.appKey,
|
||||
'actionKey': 'appkey',
|
||||
'channel': 'master',
|
||||
@@ -313,11 +320,9 @@ class LiveHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState<List<AreaList>?>> liveAreaList({
|
||||
required bool isLogin,
|
||||
}) async {
|
||||
static Future<LoadingState<List<AreaList>?>> liveAreaList() async {
|
||||
final params = {
|
||||
'access_key': ?Accounts.main.accessKey,
|
||||
'access_key': ?recommend.accessKey,
|
||||
'appkey': Constants.appKey,
|
||||
'actionKey': 'appkey',
|
||||
'build': 8430300,
|
||||
@@ -352,9 +357,7 @@ class LiveHttp {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<LoadingState<List<AreaItem>>> getLiveFavTag({
|
||||
required bool isLogin,
|
||||
}) async {
|
||||
static Future<LoadingState<List<AreaItem>>> getLiveFavTag() async {
|
||||
final params = {
|
||||
'access_key': ?Accounts.main.accessKey,
|
||||
'appkey': Constants.appKey,
|
||||
@@ -432,11 +435,10 @@ class LiveHttp {
|
||||
}
|
||||
|
||||
static Future<LoadingState<List<AreaItem>?>> liveRoomAreaList({
|
||||
required bool isLogin,
|
||||
required parentid,
|
||||
required Object parentid,
|
||||
}) async {
|
||||
final params = {
|
||||
'access_key': ?Accounts.main.accessKey,
|
||||
'access_key': ?recommend.accessKey,
|
||||
'appkey': Constants.appKey,
|
||||
'actionKey': 'appkey',
|
||||
'build': 8430300,
|
||||
@@ -473,13 +475,12 @@ class LiveHttp {
|
||||
}
|
||||
|
||||
static Future<LoadingState<LiveSearchData>> liveSearch({
|
||||
required bool isLogin,
|
||||
required int page,
|
||||
required String keyword,
|
||||
required LiveSearchType type,
|
||||
}) async {
|
||||
final params = {
|
||||
'access_key': ?Accounts.main.accessKey,
|
||||
'access_key': ?recommend.accessKey,
|
||||
'appkey': Constants.appKey,
|
||||
'actionKey': 'appkey',
|
||||
'build': 8430300,
|
||||
|
||||
@@ -62,8 +62,23 @@ class PgcHttp {
|
||||
int? indexType,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
Api.pgcIndex,
|
||||
Api.pgcIndexResult,
|
||||
queryParameters: {
|
||||
'st': 1,
|
||||
'order': 3,
|
||||
'season_version': -1,
|
||||
'spoken_language_type': -1,
|
||||
'area': -1,
|
||||
'is_finish': -1,
|
||||
'copyright': -1,
|
||||
'season_status': -1,
|
||||
'season_month': -1,
|
||||
'year': -1,
|
||||
'style_id': -1,
|
||||
'sort': 0,
|
||||
'season_type': 1,
|
||||
'pagesize': 20,
|
||||
'type': 1,
|
||||
'page': page,
|
||||
'index_type': ?indexType,
|
||||
},
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:PiliPlus/models_new/live/live_feed_index/data.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_second_list/data.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_second_list/tag.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LiveController extends CommonListController {
|
||||
@@ -17,8 +16,6 @@ class LiveController extends CommonListController {
|
||||
queryData();
|
||||
}
|
||||
|
||||
AccountService accountService = Get.find<AccountService>();
|
||||
|
||||
int? count;
|
||||
|
||||
// area
|
||||
@@ -75,16 +72,12 @@ class LiveController extends CommonListController {
|
||||
if (areaIndex.value != 0) {
|
||||
return LiveHttp.liveSecondList(
|
||||
pn: page,
|
||||
isLogin: accountService.isLogin.value,
|
||||
areaId: areaId,
|
||||
parentAreaId: parentAreaId,
|
||||
sortType: sortType,
|
||||
);
|
||||
}
|
||||
return LiveHttp.liveFeedIndex(
|
||||
pn: page,
|
||||
isLogin: accountService.isLogin.value,
|
||||
);
|
||||
return LiveHttp.liveFeedIndex(pn: page);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -99,11 +92,7 @@ class LiveController extends CommonListController {
|
||||
}
|
||||
|
||||
Future<void> queryTop() async {
|
||||
final res = await LiveHttp.liveFeedIndex(
|
||||
pn: page,
|
||||
isLogin: accountService.isLogin.value,
|
||||
moduleSelect: true,
|
||||
);
|
||||
final res = await LiveHttp.liveFeedIndex(pn: page, moduleSelect: true);
|
||||
if (res.isSuccess) {
|
||||
final data = res.data;
|
||||
topState.value = Pair(
|
||||
|
||||
@@ -36,12 +36,10 @@ class LiveAreaController
|
||||
|
||||
@override
|
||||
Future<LoadingState<List<AreaList>?>> customGetData() =>
|
||||
LiveHttp.liveAreaList(isLogin: accountService.isLogin.value);
|
||||
LiveHttp.liveAreaList();
|
||||
|
||||
Future<void> queryFavTags() async {
|
||||
favState.value = await LiveHttp.getLiveFavTag(
|
||||
isLogin: accountService.isLogin.value,
|
||||
);
|
||||
favState.value = await LiveHttp.getLiveFavTag();
|
||||
}
|
||||
|
||||
Future<void> setFavTag() async {
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:PiliPlus/models_new/live/live_feed_index/card_data_list_item.dar
|
||||
import 'package:PiliPlus/models_new/live/live_second_list/data.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_second_list/tag.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LiveAreaChildController
|
||||
@@ -23,8 +22,6 @@ class LiveAreaChildController
|
||||
final RxInt tagIndex = 0.obs;
|
||||
List<LiveSecondTag>? newTags;
|
||||
|
||||
AccountService accountService = Get.find<AccountService>();
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
@@ -53,7 +50,6 @@ class LiveAreaChildController
|
||||
Future<LoadingState<LiveSecondData>> customGetData() =>
|
||||
LiveHttp.liveSecondList(
|
||||
pn: page,
|
||||
isLogin: accountService.isLogin.value,
|
||||
areaId: areaId,
|
||||
parentAreaId: parentAreaId,
|
||||
sortType: sortType,
|
||||
|
||||
@@ -4,8 +4,6 @@ import 'package:PiliPlus/http/live.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_area_list/area_item.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LiveAreaDatailController
|
||||
extends CommonListController<List<AreaItem>?, AreaItem> {
|
||||
@@ -15,8 +13,6 @@ class LiveAreaDatailController
|
||||
|
||||
late int initialIndex = 0;
|
||||
|
||||
AccountService accountService = Get.find<AccountService>();
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
@@ -33,8 +29,5 @@ class LiveAreaDatailController
|
||||
|
||||
@override
|
||||
Future<LoadingState<List<AreaItem>?>> customGetData() =>
|
||||
LiveHttp.liveRoomAreaList(
|
||||
isLogin: accountService.isLogin.value,
|
||||
parentid: parentAreaId,
|
||||
);
|
||||
LiveHttp.liveRoomAreaList(parentid: parentAreaId);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import 'package:PiliPlus/models/common/live_search_type.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_search/data.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:PiliPlus/pages/live_search/controller.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LiveSearchChildController
|
||||
extends CommonListController<LiveSearchData, dynamic> {
|
||||
@@ -14,8 +12,6 @@ class LiveSearchChildController
|
||||
final LiveSearchController controller;
|
||||
final LiveSearchType searchType;
|
||||
|
||||
AccountService accountService = Get.find<AccountService>();
|
||||
|
||||
@override
|
||||
void checkIsEnd(int length) {
|
||||
switch (searchType) {
|
||||
@@ -48,7 +44,6 @@ class LiveSearchChildController
|
||||
@override
|
||||
Future<LoadingState<LiveSearchData>> customGetData() {
|
||||
return LiveHttp.liveSearch(
|
||||
isLogin: accountService.isLogin.value,
|
||||
page: page,
|
||||
keyword: controller.editingController.text,
|
||||
type: searchType,
|
||||
|
||||
@@ -51,6 +51,7 @@ class AccountManager extends Interceptor {
|
||||
Api.getSeasonDetailApi,
|
||||
Api.liveRoomDmToken,
|
||||
Api.liveRoomDmPrefetch,
|
||||
Api.superChatMsg,
|
||||
Api.searchByType,
|
||||
Api.dynSearch,
|
||||
Api.searchArchive,
|
||||
@@ -68,6 +69,18 @@ class AccountManager extends Interceptor {
|
||||
Api.liveList,
|
||||
Api.searchTrending,
|
||||
Api.searchRecommend,
|
||||
Api.getRankApi,
|
||||
Api.pgcRank,
|
||||
Api.pgcSeasonRank,
|
||||
Api.pgcIndexResult,
|
||||
Api.popularSeriesOne,
|
||||
Api.popularSeriesList,
|
||||
Api.popularPrecious,
|
||||
Api.liveAreaList,
|
||||
Api.liveFeedIndex,
|
||||
Api.liveSecondList,
|
||||
Api.liveRoomAreaList,
|
||||
Api.liveSearch,
|
||||
},
|
||||
// progress
|
||||
AccountType.video: {
|
||||
|
||||
Reference in New Issue
Block a user