Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
fix(YouTube - Hide Shorts components): Hide paid promotion label
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Apr 18, 2024
1 parent 4cacbf6 commit 3ce100c
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public final class ShortsFilter extends Filter {

private final static String REEL_CHANNEL_BAR_PATH = "reel_channel_bar.eml";
/**
* For subscribe button that appears in the channel bar.
* For paid promotion label and subscribe button that appears in the channel bar.
*/
private final static String REEL_METAPANEL_PATH = "reel_metapanel.eml";

Expand All @@ -29,6 +29,7 @@ public final class ShortsFilter extends Filter {

private final StringFilterGroup subscribeButton;
private final StringFilterGroup joinButton;
private final StringFilterGroup paidPromotionButton;
private final StringFilterGroup shelfHeader;

private final StringFilterGroup suggestedAction;
Expand Down Expand Up @@ -117,6 +118,11 @@ public ShortsFilter() {
"subscribe_button"
);

paidPromotionButton = new StringFilterGroup(
Settings.HIDE_PAID_PROMOTION_LABEL,
"reel_player_disclosure.eml"
);

actionBar = new StringFilterGroup(
null,
"shorts_action_bar"
Expand All @@ -129,8 +135,8 @@ public ShortsFilter() {

addPathCallbacks(
shortsCompactFeedVideoPath, suggestedAction, actionBar, joinButton, subscribeButton,
pausedOverlayButtons, channelBar, fullVideoLinkLabel, videoTitle, reelSoundMetadata,
soundButton, infoPanel
paidPromotionButton, pausedOverlayButtons, channelBar, fullVideoLinkLabel, videoTitle,
reelSoundMetadata, soundButton, infoPanel
);

//
Expand Down Expand Up @@ -196,7 +202,7 @@ public ShortsFilter() {
boolean isFiltered(@Nullable String identifier, String path, byte[] protobufBufferArray,
StringFilterGroup matchedGroup, FilterContentType contentType, int contentIndex) {
if (contentType == FilterContentType.PATH) {
if (matchedGroup == subscribeButton || matchedGroup == joinButton) {
if (matchedGroup == subscribeButton || matchedGroup == joinButton || matchedGroup == paidPromotionButton) {
// Selectively filter to avoid false positive filtering of other subscribe/join buttons.
if (path.startsWith(REEL_CHANNEL_BAR_PATH) || path.startsWith(REEL_METAPANEL_PATH)) {
return super.isFiltered(
Expand Down

0 comments on commit 3ce100c

Please sign in to comment.