opt: filter data

Closes #283

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-19 15:19:50 +08:00
parent cfb6c674ea
commit f22cad42d7
9 changed files with 53 additions and 65 deletions

View File

@@ -32,6 +32,8 @@ import 'login.dart';
class VideoHttp {
static bool enableRcmdDynamic =
GStorage.setting.get(SettingBoxKey.enableRcmdDynamic, defaultValue: true);
static RegExp zoneRegExp =
RegExp(GStorage.banWordForZone, caseSensitive: false);
// 首页推荐视频
static Future<LoadingState> rcmdVideoList(
@@ -145,10 +147,8 @@ class VideoHttp {
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
(i['args'] != null &&
!blackMidsList.contains(i['args']['up_id']))) {
String banWordForZone = GStorage.banWordForZone;
if (banWordForZone.isNotEmpty &&
RegExp(banWordForZone, caseSensitive: false)
.hasMatch(i['args']['rname'])) {
if (zoneRegExp.pattern.isNotEmpty &&
zoneRegExp.hasMatch(i['args']['rname'])) {
continue;
}
RecVideoItemAppModel videoItem = RecVideoItemAppModel.fromJson(i);
@@ -178,10 +178,8 @@ class VideoHttp {
!RecommendFilter.filterTitle(i['title']) &&
!RecommendFilter.filterLikeRatio(
i['stat']['like'], i['stat']['view'])) {
String banWordForZone = GStorage.banWordForZone;
if (banWordForZone.isNotEmpty &&
RegExp(banWordForZone, caseSensitive: false)
.hasMatch(i['tname'])) {
if (zoneRegExp.pattern.isNotEmpty &&
zoneRegExp.hasMatch(i['tname'])) {
continue;
}
list.add(HotVideoItemModel.fromJson(i));
@@ -1096,10 +1094,8 @@ class VideoHttp {
!RecommendFilter.filterTitle(i['title']) &&
!RecommendFilter.filterLikeRatio(
i['stat']['like'], i['stat']['view'])) {
String banWordForZone = GStorage.banWordForZone;
if (banWordForZone.isNotEmpty &&
RegExp(banWordForZone, caseSensitive: false)
.hasMatch(i['tname'])) {
if (zoneRegExp.pattern.isNotEmpty &&
zoneRegExp.hasMatch(i['tname'])) {
continue;
}
list.add(HotVideoItemModel.fromJson(i));