From a7c220a4aea93ea7ae7005b5760443d7571c4228 Mon Sep 17 00:00:00 2001 From: ILoveOpenSourceApplications <117499019+ILoveOpenSourceApplications@users.noreply.github.com> Date: Mon, 8 Dec 2025 18:21:57 +0530 Subject: [PATCH] feat(YouTube - Hide Shorts components): Add "Hide auto-dubbed label" and "Hide live preview" options (#6334) --- .../patches/components/ShortsFilter.java | 33 +++++++++++++++---- .../extension/youtube/settings/Settings.java | 2 ++ .../hide/shorts/HideShortsComponentsPatch.kt | 2 ++ .../resources/addresources/values/strings.xml | 6 ++++ 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/ShortsFilter.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/ShortsFilter.java index f41f1e3a3..f2dea7af4 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/ShortsFilter.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/ShortsFilter.java @@ -44,9 +44,10 @@ public final class ShortsFilter extends Filter { private final StringFilterGroup useTemplateButton; private final ByteArrayFilterGroup useTemplateButtonBuffer; + private final StringFilterGroup autoDubbedLabel; private final StringFilterGroup subscribeButton; private final StringFilterGroup joinButton; - private final StringFilterGroup paidPromotionButton; + private final StringFilterGroup paidPromotionLabel; private final StringFilterGroup shelfHeader; private final StringFilterGroup suggestedAction; @@ -161,6 +162,18 @@ public final class ShortsFilter extends Filter { "participation_bar.e" ); + StringFilterGroup livePreview = new StringFilterGroup( + Settings.HIDE_SHORTS_LIVE_PREVIEW, + // Live Shorts preview that can popup while scrolling through Shorts player. + // Can be removed if a way to disable live Shorts is found. + "live_preview_page_vm.e" + ); + + autoDubbedLabel = new StringFilterGroup( + Settings.HIDE_SHORTS_AUTO_DUBBED_LABEL, + "badge." + ); + joinButton = new StringFilterGroup( Settings.HIDE_SHORTS_JOIN_BUTTON, "sponsor_button" @@ -171,9 +184,10 @@ public final class ShortsFilter extends Filter { "subscribe_button" ); - paidPromotionButton = new StringFilterGroup( + paidPromotionLabel = new StringFilterGroup( Settings.HIDE_PAID_PROMOTION_LABEL, - "reel_player_disclosure.e" + "reel_player_disclosure.e", + "shorts_disclosures.e" ); shortsActionBar = new StringFilterGroup( @@ -219,10 +233,10 @@ public final class ShortsFilter extends Filter { ); addPathCallbacks( - shortsCompactFeedVideo, joinButton, subscribeButton, paidPromotionButton, + shortsCompactFeedVideo, joinButton, subscribeButton, paidPromotionLabel, autoDubbedLabel, shortsActionBar, suggestedAction, pausedOverlayButtons, channelBar, previewComment, fullVideoLinkLabel, videoTitle, useSoundButton, reelSoundMetadata, soundButton, infoPanel, - stickers, likeFountain, likeButton, dislikeButton + stickers, likeFountain, likeButton, dislikeButton, livePreview ); // @@ -250,6 +264,12 @@ public final class ShortsFilter extends Filter { // Suggested actions. // suggestedActionsBuffer.addAll( + new ByteArrayFilterGroup( + Settings.HIDE_SHORTS_PREVIEW_COMMENT, + // Preview comment that can popup while a Short is playing. + // Uses no bundled icons, and instead the users profile photo is shown. + "shorts-comments-panel" + ), new ByteArrayFilterGroup( Settings.HIDE_SHORTS_SHOP_BUTTON, "yt_outline_bag_" @@ -322,7 +342,8 @@ public final class ShortsFilter extends Filter { boolean isFiltered(String identifier, String path, byte[] buffer, StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) { if (contentType == FilterContentType.PATH) { - if (matchedGroup == subscribeButton || matchedGroup == joinButton || matchedGroup == paidPromotionButton) { + if (matchedGroup == subscribeButton || matchedGroup == joinButton + || matchedGroup == paidPromotionLabel || matchedGroup == autoDubbedLabel) { // Selectively filter to avoid false positive filtering of other subscribe/join buttons. return path.startsWith(REEL_CHANNEL_BAR_PATH) || path.startsWith(REEL_METAPANEL_PATH); } diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java index 38e83826a..37f715e2b 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/settings/Settings.java @@ -295,6 +295,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting DISABLE_RESUMING_SHORTS_PLAYER = new BooleanSetting("revanced_disable_resuming_shorts_player", FALSE); public static final BooleanSetting DISABLE_SHORTS_BACKGROUND_PLAYBACK = new BooleanSetting("revanced_shorts_disable_background_playback", FALSE); public static final EnumSetting SHORTS_PLAYER_TYPE = new EnumSetting<>("revanced_shorts_player_type", ShortsPlayerType.SHORTS_PLAYER); + public static final BooleanSetting HIDE_SHORTS_AUTO_DUBBED_LABEL = new BooleanSetting("revanced_hide_shorts_auto_dubbed_label", FALSE); public static final BooleanSetting HIDE_SHORTS_CHANNEL_BAR = new BooleanSetting("revanced_hide_shorts_channel_bar", FALSE); public static final BooleanSetting HIDE_SHORTS_COMMENTS_BUTTON = new BooleanSetting("revanced_hide_shorts_comments_button", FALSE); public static final BooleanSetting HIDE_SHORTS_DISLIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_dislike_button", FALSE); @@ -309,6 +310,7 @@ public class Settings extends BaseSettings { public static final BooleanSetting HIDE_SHORTS_JOIN_BUTTON = new BooleanSetting("revanced_hide_shorts_join_button", TRUE); public static final BooleanSetting HIDE_SHORTS_LIKE_BUTTON = new BooleanSetting("revanced_hide_shorts_like_button", FALSE); public static final BooleanSetting HIDE_SHORTS_LIKE_FOUNTAIN = new BooleanSetting("revanced_hide_shorts_like_fountain", TRUE); + public static final BooleanSetting HIDE_SHORTS_LIVE_PREVIEW = new BooleanSetting("revanced_hide_shorts_live_preview", FALSE); public static final BooleanSetting HIDE_SHORTS_LOCATION_LABEL = new BooleanSetting("revanced_hide_shorts_location_label", FALSE); public static final BooleanSetting HIDE_SHORTS_NAVIGATION_BAR = new BooleanSetting("revanced_hide_shorts_navigation_bar", FALSE, true); public static final BooleanSetting HIDE_SHORTS_PAUSED_OVERLAY_BUTTONS = new BooleanSetting("revanced_hide_shorts_paused_overlay_buttons", FALSE); diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt index de715d06c..1109e910e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt @@ -101,6 +101,7 @@ private val hideShortsComponentsResourcePatch = resourcePatch { SwitchPreference("revanced_hide_shorts_effect_button"), SwitchPreference("revanced_hide_shorts_green_screen_button"), SwitchPreference("revanced_hide_shorts_hashtag_button"), + SwitchPreference("revanced_hide_shorts_live_preview"), SwitchPreference("revanced_hide_shorts_new_posts_button"), SwitchPreference("revanced_hide_shorts_shop_button"), SwitchPreference("revanced_hide_shorts_tagged_products"), @@ -109,6 +110,7 @@ private val hideShortsComponentsResourcePatch = resourcePatch { SwitchPreference("revanced_hide_shorts_stickers"), // Bottom of the screen. + SwitchPreference("revanced_hide_shorts_auto_dubbed_label"), SwitchPreference("revanced_hide_shorts_location_label"), SwitchPreference("revanced_hide_shorts_channel_bar"), SwitchPreference("revanced_hide_shorts_info_panel"), diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml index b8da1a550..7580fca19 100644 --- a/patches/src/main/resources/addresources/values/strings.xml +++ b/patches/src/main/resources/addresources/values/strings.xml @@ -893,6 +893,9 @@ To show the Audio track menu, change \'Spoof video streams\' to \'Android No SDK Hide Shorts in watch history Hidden in watch history Shown in watch history + Hide auto-dubbed label + Auto-dubbed label is hidden + Auto-dubbed label is shown Hide Buy Super Thanks button Buy Super Thanks button is hidden Buy Super Thanks button is shown @@ -909,6 +912,9 @@ To show the Audio track menu, change \'Spoof video streams\' to \'Android No SDK Hide Join button Join button is hidden Join button is shown + Hide live preview + Live preview is hidden + Live preview is shown Hide location label Location label is hidden Location label is shown