Skip to content

Commit

Permalink
feat(YouTube - Hide layout components): Hide search result recommenda…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
oSumAtrIX committed Dec 24, 2023
1 parent 2814d9d commit d241e43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Expand Up @@ -28,6 +28,8 @@ public final class LayoutComponentsFilter extends Filter {
private final StringFilterGroup inFeedSurvey;
private final StringFilterGroup notifyMe;
private final StringFilterGroup expandableMetadata;
private final ByteArrayFilterGroup searchResultRecommendations;
private final StringFilterGroup searchResultVideo;

static {
mixPlaylistsExceptions.addPatterns(
Expand Down Expand Up @@ -85,7 +87,6 @@ public LayoutComponentsFilter() {
"sponsorships_comments_upsell"
);


final var channelMemberShelf = new StringFilterGroup(
SettingsEnum.HIDE_CHANNEL_MEMBER_SHELF,
"member_recognition_shelf"
Expand Down Expand Up @@ -208,6 +209,16 @@ public LayoutComponentsFilter() {
"mixed_content_shelf"
);

searchResultVideo = new StringFilterGroup(
SettingsEnum.HIDE_SEARCH_RESULT_RECOMMENDATIONS,
"search_video_with_context.eml"
);

searchResultRecommendations = new ByteArrayFilterGroup(
SettingsEnum.HIDE_SEARCH_RESULT_RECOMMENDATIONS,
"endorsement_header_footer"
);

addPathCallbacks(
custom,
expandableMetadata,
Expand All @@ -216,6 +227,7 @@ public LayoutComponentsFilter() {
channelBar,
communityPosts,
paidContent,
searchResultVideo,
latestPosts,
channelWatermark,
communityGuidelines,
Expand All @@ -240,6 +252,8 @@ public LayoutComponentsFilter() {
@Override
public boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
if (matchedGroup == searchResultVideo)
return searchResultRecommendations.check(protobufBufferArray).isFiltered();

// The groups are excluded from the filter due to the exceptions list below.
// Filter them separately here.
Expand Down
Expand Up @@ -121,6 +121,7 @@ public enum SettingsEnum {
HIDE_VIDEO_CHANNEL_WATERMARK("revanced_hide_channel_watermark", BOOLEAN, TRUE),
HIDE_FOR_YOU_SHELF("revanced_hide_for_you_shelf", BOOLEAN, TRUE),
HIDE_VIDEO_QUALITY_MENU_FOOTER("revanced_hide_video_quality_menu_footer", BOOLEAN, TRUE),
HIDE_SEARCH_RESULT_RECOMMENDATIONS("revanced_hide_search_result_recommendations", BOOLEAN, TRUE),
PLAYER_OVERLAY_OPACITY("revanced_player_overlay_opacity", INTEGER, 100, true),
PLAYER_POPUP_PANELS("revanced_hide_player_popup_panels", BOOLEAN, FALSE),
SPOOF_APP_VERSION("revanced_spoof_app_version", BOOLEAN, FALSE, true, "revanced_spoof_app_version_user_dialog_message"),
Expand Down

0 comments on commit d241e43

Please sign in to comment.