From 521fd48602432ab436d8711c19d7130b2b05af12 Mon Sep 17 00:00:00 2001
From: ILoveOpenSourceApplications
<117499019+ILoveOpenSourceApplications@users.noreply.github.com>
Date: Mon, 24 Mar 2025 21:53:57 +0530
Subject: [PATCH] feat(YouTube - Video description): Add `Hide AI-generated
video summary` (#4636)
---
.../patches/components/DescriptionComponentsFilter.java | 6 ++++++
.../app/revanced/extension/youtube/settings/Settings.java | 1 +
.../layout/hide/general/HideLayoutComponentsPatch.kt | 1 +
patches/src/main/resources/addresources/values/strings.xml | 3 +++
4 files changed, 11 insertions(+)
diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/DescriptionComponentsFilter.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/DescriptionComponentsFilter.java
index 1f33d9701..3ccdd97f8 100644
--- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/DescriptionComponentsFilter.java
+++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/DescriptionComponentsFilter.java
@@ -23,6 +23,11 @@ final class DescriptionComponentsFilter extends Filter {
"metadata"
);
+ final StringFilterGroup aiGeneratedVideoSummarySection = new StringFilterGroup(
+ Settings.HIDE_AI_GENERATED_VIDEO_SUMMARY_SECTION,
+ "cell_expandable_metadata.eml"
+ );
+
final StringFilterGroup attributesSection = new StringFilterGroup(
Settings.HIDE_ATTRIBUTES_SECTION,
"gaming_section",
@@ -67,6 +72,7 @@ final class DescriptionComponentsFilter extends Filter {
);
addPathCallbacks(
+ aiGeneratedVideoSummarySection,
attributesSection,
infoCardsSection,
howThisWasMadeSection,
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 d52fe5eae..a0fb4b13e 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
@@ -177,6 +177,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_COMMENTS_SECTION = new BooleanSetting("revanced_hide_comments_section", FALSE);
public static final BooleanSetting HIDE_COMMENTS_THANKS_BUTTON = new BooleanSetting("revanced_hide_comments_thanks_button", TRUE);
// Description
+ public static final BooleanSetting HIDE_AI_GENERATED_VIDEO_SUMMARY_SECTION = new BooleanSetting("revanced_hide_ai_generated_video_summary_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_HOW_THIS_WAS_MADE_SECTION = new BooleanSetting("revanced_hide_how_this_was_made_section", FALSE);
diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt
index 910941119..29e9a9802 100644
--- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt
+++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt
@@ -142,6 +142,7 @@ val hideLayoutComponentsPatch = bytecodePatch(
PreferenceScreenPreference(
key = "revanced_hide_description_components_screen",
preferences = setOf(
+ SwitchPreference("revanced_hide_ai_generated_video_summary_section"),
SwitchPreference("revanced_hide_attributes_section"),
SwitchPreference("revanced_hide_chapters_section"),
SwitchPreference("revanced_hide_info_cards_section"),
diff --git a/patches/src/main/resources/addresources/values/strings.xml b/patches/src/main/resources/addresources/values/strings.xml
index 5ef91e69e..6b1085447 100644
--- a/patches/src/main/resources/addresources/values/strings.xml
+++ b/patches/src/main/resources/addresources/values/strings.xml
@@ -283,6 +283,9 @@ You will not be notified of any unexpected events."
Hide artist cards
Artist cards are hidden
Artist cards are shown
+ Hide \'AI-generated video summary\'
+ Video summary section is hidden
+ Video summary section is shown
Hide Attributes
Featured places, Games, Music, and People mentioned sections are hidden
Featured places, Games, Music, and People mentioned sections are shown