mod: hot: filter like ratio

Closes #108

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-07 12:18:00 +08:00
parent a0afbb2615
commit 75a242de2a
2 changed files with 15 additions and 7 deletions

View File

@@ -168,7 +168,9 @@ class VideoHttp {
List<int> blackMidsList = GStorage.blackMidsList;
for (var i in res.data['data']['list']) {
if (!blackMidsList.contains(i['owner']['mid']) &&
!RecommendFilter.filterTitle(i['title'])) {
!RecommendFilter.filterTitle(i['title']) &&
!RecommendFilter.filterLikeRatio(
i['stat']['like'], i['stat']['view'])) {
list.add(HotVideoItemModel.fromJson(i));
}
}

View File

@@ -43,12 +43,7 @@ class RecommendFilter {
if (videoItem.duration > 0 && videoItem.duration < minDurationForRcmd) {
return true;
}
if (videoItem.stat.view is int &&
videoItem.stat.view > -1 &&
videoItem.stat.like is int &&
videoItem.stat.like > -1 &&
videoItem.stat.like * 100 <
minLikeRatioForRecommend * videoItem.stat.view) {
if (filterLikeRatio(videoItem.stat.like, videoItem.stat.view)) {
return true;
}
if (filterTitle(videoItem.title)) {
@@ -57,6 +52,17 @@ class RecommendFilter {
return false;
}
static bool filterLikeRatio(like, view) {
if (view is int &&
view > -1 &&
like is int &&
like > -1 &&
like * 100 < minLikeRatioForRecommend * view) {
return true;
}
return false;
}
static bool filterTitle(String title, {bool? isFollowed}) {
if (exemptFilterForFollowed && isFollowed == true) {
return false;