feat(YouTube - Hide layout components): Hide search result recommendations

This commit is contained in:
oSumAtrIX 2023-12-24 18:06:48 +01:00
parent 2814d9d8c4
commit d241e437ee
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
2 changed files with 16 additions and 1 deletions

View File

@ -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(
@ -85,7 +87,6 @@ public final class LayoutComponentsFilter extends Filter {
"sponsorships_comments_upsell"
);
final var channelMemberShelf = new StringFilterGroup(
SettingsEnum.HIDE_CHANNEL_MEMBER_SHELF,
"member_recognition_shelf"
@ -208,6 +209,16 @@ public final class LayoutComponentsFilter extends Filter {
"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,
@ -216,6 +227,7 @@ public final class LayoutComponentsFilter extends Filter {
channelBar,
communityPosts,
paidContent,
searchResultVideo,
latestPosts,
channelWatermark,
communityGuidelines,
@ -240,6 +252,8 @@ public final class LayoutComponentsFilter extends Filter {
@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.

View File

@ -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"),