Skip to content

Commit 5203da0

Browse files
fix(YouTube - Hide layout components): Fix "Hide AI-generated video summary" in video description (#5269)
1 parent 2fe4607 commit 5203da0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/components/DescriptionComponentsFilter.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import app.revanced.extension.youtube.StringTrieSearch;
66
import app.revanced.extension.youtube.settings.Settings;
7+
import app.revanced.extension.youtube.shared.PlayerType;
78

89
@SuppressWarnings("unused")
910
final class DescriptionComponentsFilter extends Filter {
@@ -17,6 +18,8 @@ final class DescriptionComponentsFilter extends Filter {
1718
private final StringFilterGroup horizontalShelf;
1819
private final ByteArrayFilterGroup cellVideoAttribute;
1920

21+
private final StringFilterGroup aiGeneratedVideoSummarySection;
22+
2023
public DescriptionComponentsFilter() {
2124
exceptions.addPatterns(
2225
"compact_channel",
@@ -26,7 +29,7 @@ public DescriptionComponentsFilter() {
2629
"metadata"
2730
);
2831

29-
final StringFilterGroup aiGeneratedVideoSummarySection = new StringFilterGroup(
32+
aiGeneratedVideoSummarySection = new StringFilterGroup(
3033
Settings.HIDE_AI_GENERATED_VIDEO_SUMMARY_SECTION,
3134
"cell_expandable_metadata.eml"
3235
);
@@ -104,6 +107,12 @@ public DescriptionComponentsFilter() {
104107
@Override
105108
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
106109
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
110+
111+
if (matchedGroup == aiGeneratedVideoSummarySection) {
112+
// Only hide if player is open, in case this component is used somewhere else.
113+
return PlayerType.getCurrent().isMaximizedOrFullscreen();
114+
}
115+
107116
if (exceptions.matches(path)) return false;
108117

109118
if (matchedGroup == macroMarkersCarousel) {

0 commit comments

Comments
 (0)