Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
feat(YouTube/Hide feed components): separate the `Hide low views vide…
Browse files Browse the repository at this point in the history
…o` settings from `Hide recommended videos` settings
  • Loading branch information
inotia00 authored and anddea committed Jun 11, 2024
1 parent 2707232 commit 730c58c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ public final class FeedVideoFilter extends Filter {
null,
"endorsement_header_footer" // videos with gray descriptions
);
private final ByteArrayFilterGroup homeFeedRecommendations = new ByteArrayFilterGroup(
null,
"g-highZ", // videos with less than 1000 views
private final ByteArrayFilterGroup videosForMembershipOnly = new ByteArrayFilterGroup(
Settings.HIDE_RECOMMENDED_VIDEO,
"high-ptsZ" // videos for membership only
);
private final ByteArrayFilterGroup videosWithLowView = new ByteArrayFilterGroup(
Settings.HIDE_LOW_VIEWS_VIDEO,
"g-highZ" // videos with less than 1000 views
);
// In search results, vertical video with shorts labels mostly include videos with gray descriptions.
// Filters without check process.
private final StringFilterGroup inlineShorts;
Expand All @@ -30,7 +33,7 @@ public final class FeedVideoFilter extends Filter {

public FeedVideoFilter() {
homeFeedVideoFilter = new StringFilterGroup(
Settings.HIDE_RECOMMENDED_VIDEO,
null,
"home_video_with_context.eml"
);
feedVideo = new StringFilterGroup(
Expand Down Expand Up @@ -62,7 +65,10 @@ public boolean isFiltered(String path, @Nullable String identifier, String allVa
return false;
}
if (matchedGroup == homeFeedVideoFilter) {
if (contentIndex != 0 || !homeFeedRecommendations.check(protobufBufferArray).isFiltered()) {
if (contentIndex != 0) {
return false;
}
if (!videosForMembershipOnly.check(protobufBufferArray).isFiltered() && !videosWithLowView.check(protobufBufferArray).isFiltered()) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public class Settings extends BaseSettings {
parentsAny(HIDE_KEYWORD_CONTENT_HOME, HIDE_KEYWORD_CONTENT_SEARCH, HIDE_KEYWORD_CONTENT_SUBSCRIPTIONS, HIDE_KEYWORD_CONTENT_COMMENTS));

public static final BooleanSetting HIDE_RECOMMENDED_VIDEO = new BooleanSetting("revanced_hide_recommended_video", FALSE);
public static final BooleanSetting HIDE_LOW_VIEWS_VIDEO = new BooleanSetting("revanced_hide_low_views_video", TRUE);

public static final BooleanSetting HIDE_VIDEO_BY_DURATION = new BooleanSetting("revanced_hide_video_by_duration", FALSE);
public static final StringSetting HIDE_VIDEO_BY_DURATION_SHORTER_THAN = new StringSetting("revanced_hide_video_by_duration_shorter_than", "0:10", parent(HIDE_VIDEO_BY_DURATION));
Expand Down

0 comments on commit 730c58c

Please sign in to comment.