diff --git a/lib/http/video.dart b/lib/http/video.dart index 716e8371..4e886a5a 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -168,7 +168,9 @@ class VideoHttp { List 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)); } } diff --git a/lib/utils/recommend_filter.dart b/lib/utils/recommend_filter.dart index 57da0a4c..017be090 100644 --- a/lib/utils/recommend_filter.dart +++ b/lib/utils/recommend_filter.dart @@ -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;