feat(YouTube - Hide layout components): Add video description "Hide Featured content" and "Hide Subscribe button" (#6253)

This commit is contained in:
ILoveOpenSourceApplications
2025-11-09 21:00:07 +05:30
committed by GitHub
parent d23fa5e3b7
commit da4cf94091
4 changed files with 36 additions and 9 deletions

View File

@@ -7,15 +7,15 @@ import app.revanced.extension.youtube.shared.PlayerType;
@SuppressWarnings("unused")
final class DescriptionComponentsFilter extends Filter {
private static final String INFOCARDS_SECTION_PATH = "infocards_section.e";
private final StringTrieSearch exceptions = new StringTrieSearch();
private final ByteArrayFilterGroupList macroMarkersCarouselGroupList = new ByteArrayFilterGroupList();
private final StringFilterGroup macroMarkersCarousel;
private final ByteArrayFilterGroupList macroMarkersCarouselGroupList = new ByteArrayFilterGroupList();
private final StringFilterGroup horizontalShelf;
private final ByteArrayFilterGroup cellVideoAttribute;
private final StringFilterGroup infoCardsSection;
private final StringFilterGroup subscribeButton;
private final StringFilterGroup aiGeneratedVideoSummarySection;
private final StringFilterGroup hypePoints;
@@ -44,9 +44,10 @@ final class DescriptionComponentsFilter extends Filter {
"video_attributes_section"
);
final StringFilterGroup infoCardsSection = new StringFilterGroup(
Settings.HIDE_INFO_CARDS_SECTION,
"infocards_section"
final StringFilterGroup featuredSection = new StringFilterGroup(
Settings.HIDE_FEATURED_SECTION,
// "media_lockup", "structured_description_video_lockup"
"compact_infocard"
);
final StringFilterGroup podcastSection = new StringFilterGroup(
@@ -69,6 +70,16 @@ final class DescriptionComponentsFilter extends Filter {
"hype_points_factoid"
);
infoCardsSection = new StringFilterGroup(
Settings.HIDE_INFO_CARDS_SECTION,
INFOCARDS_SECTION_PATH
);
subscribeButton = new StringFilterGroup(
Settings.HIDE_DESCRIPTION_SUBSCRIBE_BUTTON,
"subscribe_button"
);
macroMarkersCarousel = new StringFilterGroup(
null,
"macro_markers_carousel.e"
@@ -99,12 +110,14 @@ final class DescriptionComponentsFilter extends Filter {
aiGeneratedVideoSummarySection,
askSection,
attributesSection,
infoCardsSection,
featuredSection,
horizontalShelf,
howThisWasMadeSection,
hypePoints,
infoCardsSection,
macroMarkersCarousel,
podcastSection,
subscribeButton,
transcriptSection
);
}
@@ -118,6 +131,10 @@ final class DescriptionComponentsFilter extends Filter {
return PlayerType.getCurrent().isMaximizedOrFullscreen();
}
if (matchedGroup == subscribeButton) {
return path.startsWith(INFOCARDS_SECTION_PATH);
}
if (exceptions.matches(path)) return false;
if (matchedGroup == macroMarkersCarousel) {

View File

@@ -210,11 +210,13 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_ASK_SECTION = new BooleanSetting("revanced_hide_ask_section", FALSE);
public static final BooleanSetting HIDE_ATTRIBUTES_SECTION = new BooleanSetting("revanced_hide_attributes_section", FALSE);
public static final BooleanSetting HIDE_CHAPTERS_SECTION = new BooleanSetting("revanced_hide_chapters_section", TRUE);
public static final BooleanSetting HIDE_FEATURED_SECTION = new BooleanSetting("revanced_hide_featured_section", TRUE);
public static final BooleanSetting HIDE_HOW_THIS_WAS_MADE_SECTION = new BooleanSetting("revanced_hide_how_this_was_made_section", FALSE);
public static final BooleanSetting HIDE_HYPE_POINTS = new BooleanSetting("revanced_hide_hype_points", FALSE);
public static final BooleanSetting HIDE_INFO_CARDS_SECTION = new BooleanSetting("revanced_hide_info_cards_section", TRUE);
public static final BooleanSetting HIDE_KEY_CONCEPTS_SECTION = new BooleanSetting("revanced_hide_key_concepts_section", FALSE);
public static final BooleanSetting HIDE_PODCAST_SECTION = new BooleanSetting("revanced_hide_podcast_section", TRUE);
public static final BooleanSetting HIDE_DESCRIPTION_SUBSCRIBE_BUTTON = new BooleanSetting("revanced_hide_description_subscribe_button", TRUE);
public static final BooleanSetting HIDE_TRANSCRIPT_SECTION = new BooleanSetting("revanced_hide_transcript_section", TRUE);
// Action buttons

View File

@@ -145,11 +145,13 @@ val hideLayoutComponentsPatch = bytecodePatch(
SwitchPreference("revanced_hide_ask_section"),
SwitchPreference("revanced_hide_attributes_section"),
SwitchPreference("revanced_hide_chapters_section"),
SwitchPreference("revanced_hide_featured_section"),
SwitchPreference("revanced_hide_info_cards_section"),
SwitchPreference("revanced_hide_how_this_was_made_section"),
SwitchPreference("revanced_hide_hype_points"),
SwitchPreference("revanced_hide_key_concepts_section"),
SwitchPreference("revanced_hide_podcast_section"),
SwitchPreference("revanced_hide_description_subscribe_button"),
SwitchPreference("revanced_hide_transcript_section"),
),
),

View File

@@ -346,12 +346,18 @@ If a Doodle is currently showing in your region and this hide setting is on, the
<string name="revanced_hide_podcast_section_title">Hide \'Explore the podcast\'</string>
<string name="revanced_hide_podcast_section_summary_on">Explore the podcast section is hidden</string>
<string name="revanced_hide_podcast_section_summary_off">Explore the podcast section is shown</string>
<string name="revanced_hide_featured_section_title">Hide Featured content</string>
<string name="revanced_hide_featured_section_summary_on">Featured content section is hidden</string>
<string name="revanced_hide_featured_section_summary_off">Featured content section is shown</string>
<string name="revanced_hide_info_cards_section_title">Hide Info cards</string>
<string name="revanced_hide_info_cards_section_summary_on">Info cards section is hidden</string>
<string name="revanced_hide_info_cards_section_summary_off">Info cards section is shown</string>
<string name="revanced_hide_key_concepts_section_title">Hide \'Key concepts\'</string>
<string name="revanced_hide_key_concepts_section_summary_on">Key concepts section is hidden</string>
<string name="revanced_hide_key_concepts_section_summary_off">Key concepts section is shown</string>
<string name="revanced_hide_description_subscribe_button_title">Hide Subscribe button</string>
<string name="revanced_hide_description_subscribe_button_summary_on">Subscribe button is hidden</string>
<string name="revanced_hide_description_subscribe_button_summary_off">Subscribe button is shown</string>
<string name="revanced_hide_transcript_section_title">Hide Transcript</string>
<string name="revanced_hide_transcript_section_summary_on">Transcript section is hidden</string>
<string name="revanced_hide_transcript_section_summary_off">Transcript section is shown</string>