fix get live second list

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-02 21:06:10 +08:00
parent 4b9f251dae
commit 574e432e09
7 changed files with 180 additions and 114 deletions

View File

@@ -537,19 +537,20 @@ class FavHttp {
static Future<LoadingState<List<SpaceFavData>?>> spaceFav({ static Future<LoadingState<List<SpaceFavData>?>> spaceFav({
required int mid, required int mid,
}) async { }) async {
Map<String, String> data = { final params = {
'build': '8430300', 'build': 8430300,
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'channel': 'bili', 'channel': 'master',
'mobi_app': 'android', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
'up_mid': mid.toString(), 'up_mid': mid,
}; };
var res = await Request().get( var res = await Request().get(
Api.spaceFav, Api.spaceFav,
queryParameters: data, queryParameters: params,
options: Options( options: Options(
headers: { headers: {
'bili-http-engine': 'cronet', 'bili-http-engine': 'cronet',

View File

@@ -2,6 +2,7 @@ import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/http/api.dart'; import 'package:PiliPlus/http/api.dart';
import 'package:PiliPlus/http/init.dart'; import 'package:PiliPlus/http/init.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/http/login.dart';
import 'package:PiliPlus/http/ua_type.dart'; import 'package:PiliPlus/http/ua_type.dart';
import 'package:PiliPlus/models/common/live_search_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_item.dart';
@@ -169,23 +170,25 @@ class LiveHttp {
final params = { final params = {
if (isLogin) 'access_key': Accounts.main.accessKey, if (isLogin) 'access_key': Accounts.main.accessKey,
'appkey': Constants.appKey, 'appkey': Constants.appKey,
'channel': 'master',
'actionKey': 'appkey', 'actionKey': 'appkey',
'build': '8430300', 'build': 8430300,
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'device': 'pad', 'device': 'android',
'device_name': 'android', 'device_name': 'android',
'device_type': '0', 'device_type': 0,
'fnval': '912', 'fnval': 912,
'disable_rcmd': '0', 'disable_rcmd': 0,
'https_url_req': '1', 'https_url_req': 1,
if (moduleSelect == true) 'module_select': '1', if (moduleSelect == true) 'module_select': 1,
'mobi_app': 'android_hd', 'mobi_app': 'android',
'network': 'wifi', 'network': 'wifi',
'page': pn, 'page': pn,
'platform': 'android', 'platform': 'android',
if (isLogin) 'relation_page': '1', if (isLogin) 'relation_page': 1,
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'scale': '2', 'scale': 2,
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
'ts': DateTime.now().millisecondsSinceEpoch ~/ 1000, 'ts': DateTime.now().millisecondsSinceEpoch ~/ 1000,
}; };
@@ -197,6 +200,23 @@ class LiveHttp {
var res = await Request().get( var res = await Request().get(
Api.liveFeedIndex, Api.liveFeedIndex,
queryParameters: params, queryParameters: params,
options: Options(
headers: {
'buvid': LoginHttp.buvid,
'fp_local':
'1111111111111111111111111111111111111111111111111111111111111111',
'fp_remote':
'1111111111111111111111111111111111111111111111111111111111111111',
'session_id': '11111111',
'env': 'prod',
'app-key': 'android',
'User-Agent': Constants.userAgentApp,
'x-bili-trace-id': Constants.traceId,
'x-bili-aurora-eid': '',
'x-bili-aurora-zone': '',
'bili-http-engine': 'cronet',
},
),
); );
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
return Success(LiveIndexData.fromJson(res.data['data'])); return Success(LiveIndexData.fromJson(res.data['data']));
@@ -233,29 +253,31 @@ class LiveHttp {
if (isLogin) 'access_key': Accounts.main.accessKey, if (isLogin) 'access_key': Accounts.main.accessKey,
'appkey': Constants.appKey, 'appkey': Constants.appKey,
'actionKey': 'appkey', 'actionKey': 'appkey',
'channel': 'master',
'area_id': ?areaId, 'area_id': ?areaId,
'parent_area_id': ?parentAreaId, 'parent_area_id': ?parentAreaId,
'build': '8430300', 'build': 8430300,
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'device': 'pad', 'device': 'android',
'device_name': 'android', 'device_name': 'android',
'device_type': '0', 'device_type': 0,
'fnval': '912', 'fnval': 912,
'disable_rcmd': '0', 'disable_rcmd': 0,
'https_url_req': '1', 'https_url_req': 1,
'mobi_app': 'android_hd', 'mobi_app': 'android',
'module_select': '0', 'module_select': 0,
'network': 'wifi', 'network': 'wifi',
'page': pn, 'page': pn,
'page_size': '20', 'page_size': 20,
'platform': 'android', 'platform': 'android',
'qn': '0', 'qn': 0,
'sort_type': ?sortType, 'sort_type': ?sortType,
'tag_version': '1', 'tag_version': 1,
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'scale': '2', 'scale': 2,
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(), 'ts': DateTime.now().millisecondsSinceEpoch ~/ 1000,
}; };
AppSign.appSign( AppSign.appSign(
params, params,
@@ -265,6 +287,23 @@ class LiveHttp {
var res = await Request().get( var res = await Request().get(
Api.liveSecondList, Api.liveSecondList,
queryParameters: params, queryParameters: params,
options: Options(
headers: {
'buvid': LoginHttp.buvid,
'fp_local':
'1111111111111111111111111111111111111111111111111111111111111111',
'fp_remote':
'1111111111111111111111111111111111111111111111111111111111111111',
'session_id': '11111111',
'env': 'prod',
'app-key': 'android',
'User-Agent': Constants.userAgentApp,
'x-bili-trace-id': Constants.traceId,
'x-bili-aurora-eid': '',
'x-bili-aurora-zone': '',
'bili-http-engine': 'cronet',
},
),
); );
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
return Success(LiveSecondData.fromJson(res.data['data'])); return Success(LiveSecondData.fromJson(res.data['data']));
@@ -280,11 +319,13 @@ class LiveHttp {
if (isLogin) 'access_key': Accounts.main.accessKey, if (isLogin) 'access_key': Accounts.main.accessKey,
'appkey': Constants.appKey, 'appkey': Constants.appKey,
'actionKey': 'appkey', 'actionKey': 'appkey',
'build': '8430300', 'build': 8430300,
'channel': 'master',
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'device': 'pad', 'device': 'android',
'disable_rcmd': '0', 'disable_rcmd': 0,
'mobi_app': 'android_hd', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
@@ -317,11 +358,13 @@ class LiveHttp {
if (isLogin) 'access_key': Accounts.main.accessKey, if (isLogin) 'access_key': Accounts.main.accessKey,
'appkey': Constants.appKey, 'appkey': Constants.appKey,
'actionKey': 'appkey', 'actionKey': 'appkey',
'build': '8430300', 'build': 8430300,
'channel': 'master',
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'device': 'pad', 'device': 'android',
'disable_rcmd': '0', 'disable_rcmd': 0,
'mobi_app': 'android_hd', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
@@ -357,11 +400,13 @@ class LiveHttp {
'access_key': Accounts.main.accessKey, 'access_key': Accounts.main.accessKey,
'appkey': Constants.appKey, 'appkey': Constants.appKey,
'actionKey': 'appkey', 'actionKey': 'appkey',
'build': '8430300', 'build': 8430300,
'channel': 'master',
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'device': 'pad', 'device': 'android',
'disable_rcmd': '0', 'disable_rcmd': 0,
'mobi_app': 'android_hd', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
@@ -395,14 +440,16 @@ class LiveHttp {
if (isLogin) 'access_key': Accounts.main.accessKey, if (isLogin) 'access_key': Accounts.main.accessKey,
'appkey': Constants.appKey, 'appkey': Constants.appKey,
'actionKey': 'appkey', 'actionKey': 'appkey',
'build': '8430300', 'build': 8430300,
'channel': 'master',
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'device': 'pad', 'device': 'android',
'disable_rcmd': '0', 'disable_rcmd': 0,
'need_entrance': 1, 'need_entrance': 1,
'parent_id': parentid, 'parent_id': parentid,
'source_id': 2, 'source_id': 2,
'mobi_app': 'android_hd', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
@@ -436,14 +483,16 @@ class LiveHttp {
if (isLogin) 'access_key': Accounts.main.accessKey, if (isLogin) 'access_key': Accounts.main.accessKey,
'appkey': Constants.appKey, 'appkey': Constants.appKey,
'actionKey': 'appkey', 'actionKey': 'appkey',
'build': '8430300', 'build': 8430300,
'channel': 'master',
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'device': 'pad', 'device': 'android',
'page': page, 'page': page,
'pagesize': 30, 'pagesize': 30,
'keyword': keyword, 'keyword': keyword,
'disable_rcmd': '0', 'disable_rcmd': 0,
'mobi_app': 'android_hd', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,

View File

@@ -57,21 +57,22 @@ class MemberHttp {
required int mid, required int mid,
required int page, required int page,
}) async { }) async {
Map<String, String> data = { final params = {
'build': '8430300', 'build': 8430300,
'channel': 'master',
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'channel': 'bili',
'mobi_app': 'android', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',
'pn': page.toString(), 'pn': page,
'ps': '10', 'ps': 10,
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
'vmid': mid.toString(), 'vmid': mid,
}; };
var res = await Request().get( var res = await Request().get(
Api.spaceArticle, Api.spaceArticle,
queryParameters: data, queryParameters: params,
options: Options( options: Options(
headers: { headers: {
'bili-http-engine': 'cronet', 'bili-http-engine': 'cronet',
@@ -119,25 +120,26 @@ class MemberHttp {
int? seriesId, int? seriesId,
includeCursor, includeCursor,
}) async { }) async {
Map<String, String> data = { final params = {
if (aid != null) 'aid': aid.toString(), 'aid': ?aid,
'build': '8430300', 'build': 8430300,
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'channel': 'bili', 'channel': 'master',
'mobi_app': 'android', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'ps': '20', 'ps': 20,
if (pn != null) 'pn': pn.toString(), 'pn': ?pn,
if (next != null) 'next': next.toString(), 'next': ?next,
if (seasonId != null) 'season_id': seasonId.toString(), 'season_id': ?seasonId,
if (seriesId != null) 'series_id': seriesId.toString(), 'series_id': ?seriesId,
'qn': type == ContributeType.video ? '80' : '32', 'qn': type == ContributeType.video ? 80 : 32,
'order': ?order, 'order': ?order,
'sort': ?sort, 'sort': ?sort,
if (includeCursor != null) 'include_cursor': includeCursor.toString(), 'include_cursor': ?includeCursor,
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
'vmid': mid.toString(), 'vmid': mid,
}; };
var res = await Request().get( var res = await Request().get(
switch (type) { switch (type) {
@@ -148,7 +150,7 @@ class MemberHttp {
ContributeType.bangumi => Api.spaceBangumi, ContributeType.bangumi => Api.spaceBangumi,
ContributeType.comic => Api.spaceComic, ContributeType.comic => Api.spaceComic,
}, },
queryParameters: data, queryParameters: params,
options: Options( options: Options(
headers: { headers: {
'bili-http-engine': 'cronet', 'bili-http-engine': 'cronet',
@@ -193,25 +195,26 @@ class MemberHttp {
required contain, required contain,
required index, required index,
}) async { }) async {
Map<String, String> data = { final params = {
'aid': aid.toString(), 'aid': aid,
'before_size': beforeSize.toString(), 'before_size': beforeSize,
'after_size': afterSize.toString(), 'after_size': afterSize,
'cid': cid.toString(), 'cid': cid,
'contain': contain.toString(), 'contain': contain,
'index': index.toString(), 'index': index,
'build': '8430300', 'build': 8430300,
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'channel': 'bili', 'channel': 'master',
'mobi_app': 'android', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
'vmid': mid.toString(), 'vmid': mid,
}; };
var res = await Request().get( var res = await Request().get(
Api.spaceStory, Api.spaceStory,
queryParameters: data, queryParameters: params,
options: Options( options: Options(
headers: { headers: {
'bili-http-engine': 'cronet', 'bili-http-engine': 'cronet',
@@ -230,20 +233,21 @@ class MemberHttp {
int? mid, int? mid,
dynamic fromViewAid, dynamic fromViewAid,
}) async { }) async {
Map<String, String> data = { final params = {
'build': '8430300', 'build': 8430300,
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'channel': 'bili', 'channel': 'master',
'mobi_app': 'android', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'from_view_aid': ?fromViewAid, 'from_view_aid': ?fromViewAid,
'statistics': Constants.statisticsApp, 'statistics': Constants.statisticsApp,
'vmid': mid.toString(), 'vmid': mid,
}; };
var res = await Request().get( var res = await Request().get(
Api.space, Api.space,
queryParameters: data, queryParameters: params,
options: Options( options: Options(
headers: { headers: {
'bili-http-engine': 'cronet', 'bili-http-engine': 'cronet',
@@ -341,7 +345,7 @@ class MemberHttp {
'keyword': ?keyword, 'keyword': ?keyword,
'order': order, 'order': order,
'platform': 'web', 'platform': 'web',
'web_location': '1550101', 'web_location': 1550101,
'order_avoided': orderAvoided, 'order_avoided': orderAvoided,
'dm_img_list': '[]', 'dm_img_list': '[]',
'dm_img_str': dmImgStr, 'dm_img_str': dmImgStr,

View File

@@ -227,7 +227,9 @@ class SearchHttp {
final res = await Request().get( final res = await Request().get(
Api.searchRecommend, Api.searchRecommend,
queryParameters: { queryParameters: {
'build': '8430300', 'build': 8430300,
'channel': 'master',
'version': '8.43.0',
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'mobi_app': 'android', 'mobi_app': 'android',
'platform': 'android', 'platform': 'android',

View File

@@ -1,5 +1,4 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer';
import 'package:PiliPlus/common/constants.dart'; import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/http/api.dart'; import 'package:PiliPlus/http/api.dart';
@@ -77,38 +76,38 @@ class VideoHttp {
// 添加额外的loginState变量模拟未登录状态 // 添加额外的loginState变量模拟未登录状态
static Future<LoadingState> rcmdVideoListApp({required int freshIdx}) async { static Future<LoadingState> rcmdVideoListApp({required int freshIdx}) async {
Map<String, String> data = { final params = {
'build': '2001100', 'build': 2001100,
'c_locale': 'zh_CN', 'c_locale': 'zh_CN',
'channel': 'master', 'channel': 'master',
'column': '4', 'column': 4,
'device': 'pad', 'device': 'pad',
'device_name': 'android', 'device_name': 'android',
'device_type': '0', 'device_type': 0,
'disable_rcmd': '0', 'disable_rcmd': 0,
'flush': '5', 'flush': 5,
'fnval': '976', 'fnval': 976,
'fnver': '0', 'fnver': 0,
'force_host': '2', //使用https 'force_host': 2, //使用https
'fourk': '1', 'fourk': 1,
'guidance': '0', 'guidance': 0,
'https_url_req': '0', 'https_url_req': 0,
'idx': freshIdx.toString(), 'idx': freshIdx,
'mobi_app': 'android_hd', 'mobi_app': 'android_hd',
'network': 'wifi', 'network': 'wifi',
'platform': 'android', 'platform': 'android',
'player_net': '1', 'player_net': 1,
'pull': freshIdx == 0 ? 'true' : 'false', 'pull': freshIdx == 0 ? 'true' : 'false',
'qn': '32', 'qn': 32,
'recsys_mode': '0', 'recsys_mode': 0,
's_locale': 'zh_CN', 's_locale': 'zh_CN',
'splash_id': '', 'splash_id': '',
'statistics': Constants.statistics, 'statistics': Constants.statistics,
'voice_balance': '0', 'voice_balance': 0,
}; };
var res = await Request().get( var res = await Request().get(
Api.recommendListApp, Api.recommendListApp,
queryParameters: data, queryParameters: params,
options: Options( options: Options(
headers: { headers: {
'buvid': LoginHttp.buvid, 'buvid': LoginHttp.buvid,
@@ -465,7 +464,7 @@ class VideoHttp {
'id': id, 'id': id,
'reason_id': ?reasonId, 'reason_id': ?reasonId,
'feedback_id': ?feedbackId, 'feedback_id': ?feedbackId,
'build': '1', 'build': 1,
'mobi_app': 'android', 'mobi_app': 'android',
}, },
); );
@@ -493,7 +492,7 @@ class VideoHttp {
'id': id, 'id': id,
'reason_id': ?reasonId, 'reason_id': ?reasonId,
'feedback_id': ?feedbackId, 'feedback_id': ?feedbackId,
'build': '1', 'build': 1,
'mobi_app': 'android', 'mobi_app': 'android',
}, },
); );
@@ -542,7 +541,6 @@ class VideoHttp {
data: data, data: data,
options: Options(contentType: Headers.formUrlEncodedContentType), options: Options(contentType: Headers.formUrlEncodedContentType),
); );
log(res.toString());
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']}; return {'status': true, 'data': res.data['data']};
} else { } else {
@@ -564,7 +562,6 @@ class VideoHttp {
'csrf': Accounts.main.csrf, 'csrf': Accounts.main.csrf,
}, },
); );
log(res.toString());
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
return {'status': true}; return {'status': true};
} else { } else {

View File

@@ -3,6 +3,8 @@ import 'package:PiliPlus/http/live.dart';
import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models_new/live/live_feed_index/card_data_list_item.dart'; import 'package:PiliPlus/models_new/live/live_feed_index/card_data_list_item.dart';
import 'package:PiliPlus/models_new/live/live_feed_index/card_list.dart'; import 'package:PiliPlus/models_new/live/live_feed_index/card_list.dart';
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/models_new/live/live_second_list/tag.dart';
import 'package:PiliPlus/pages/common/common_list_controller.dart'; import 'package:PiliPlus/pages/common/common_list_controller.dart';
import 'package:PiliPlus/services/account_service.dart'; import 'package:PiliPlus/services/account_service.dart';
@@ -48,16 +50,18 @@ class LiveController extends CommonListController {
bool customHandleResponse(bool isRefresh, Success response) { bool customHandleResponse(bool isRefresh, Success response) {
if (isRefresh) { if (isRefresh) {
if (areaIndex.value == 0) { if (areaIndex.value == 0) {
if (response.response.hasMore == 0) { LiveIndexData data = response.response;
if (data.hasMore == 0) {
isEnd = true; isEnd = true;
} }
topState.value = Pair( topState.value = Pair(
first: response.response.followItem, first: data.followItem,
second: response.response.areaItem, second: data.areaItem,
); );
} else { } else {
count = response.response.count; LiveSecondData data = response.response;
newTags = response.response.newTags; count = data.count;
newTags = data.newTags;
if (sortType != null) { if (sortType != null) {
tagIndex.value = tagIndex.value =
newTags?.indexWhere((e) => e.sortType == sortType) ?? -1; newTags?.indexWhere((e) => e.sortType == sortType) ?? -1;
@@ -117,6 +121,9 @@ class LiveController extends CommonListController {
} }
void onSelectArea(int index, CardLiveItem? cardLiveItem) { void onSelectArea(int index, CardLiveItem? cardLiveItem) {
if (isLoading) {
return; // areaIndex conflict
}
if (index == areaIndex.value) { if (index == areaIndex.value) {
return; return;
} }
@@ -134,6 +141,9 @@ class LiveController extends CommonListController {
} }
void onSelectTag(int index, String? sortType) { void onSelectTag(int index, String? sortType) {
if (isLoading) {
return;
}
tagIndex.value = index; tagIndex.value = index;
this.sortType = sortType; this.sortType = sortType;

View File

@@ -60,6 +60,9 @@ class LiveAreaChildController
); );
void onSelectTag(int index, String? sortType) { void onSelectTag(int index, String? sortType) {
if (isLoading) {
return;
}
tagIndex.value = index; tagIndex.value = index;
this.sortType = sortType; this.sortType = sortType;