Skip to content

Commit

Permalink
Update AdBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
arichornlover authored Jun 23, 2024
1 parent 9b3bcd8 commit 7d11549
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,10 @@ static NSString *accessGroupID() {
%hook YTIPlayerResponse
- (BOOL)isMonetized { return NO; }
%end
%hook YTAdShieldUtils
+ (id)spamSignalsDictionary { return @{}; }
+ (id)spamSignalsDictionaryWithoutIDFA { return @{}; }
%end
%hook YTDataUtils
+ (id)spamSignalsDictionary { return @{}; }
+ (id)spamSignalsDictionaryWithoutIDFA { return @{}; }
Expand Down Expand Up @@ -833,9 +837,12 @@ BOOL isAdString(NSString *description) {
|| [description containsString:@"full_width_square_image_layout"]
|| [description containsString:@"home_video_with_context"]
|| [description containsString:@"landscape_image_wide_button_layout"]
|| [description containsString:@"post_shelf"]
|| [description containsString:@"product_carousel"]
|| [description containsString:@"product_engagement_panel"]
|| [description containsString:@"product_item"]
|| [description containsString:@"shelf_header"]
|| [description containsString:@"statement_banner"]
|| [description containsString:@"square_image_layout"]
|| [description containsString:@"text_image_button_layout"]
|| [description containsString:@"text_search_ad"]
Expand All @@ -846,14 +853,32 @@ BOOL isAdString(NSString *description) {
return YES;
return NO;
}
NSData *cellDividerData;
#define cellDividerDataBytesLength 720
static __strong NSData *cellDividerData;
static uint8_t cellDividerDataBytes[] = {
0xa, 0x8d, 0x5, 0xca, 0xeb, 0xea, 0x83, 0x5, 0x86, 0x5,
0x1a, 0x29, 0x92, 0xcb, 0xa1, 0x90, 0x5, 0x23, 0xa, 0x21,
0x63, 0x65, 0x6c, 0x6c, 0x5f, 0x64, 0x69, 0x76, 0x69, 0x64,
0x65, 0x72, 0x2e, 0x65, 0x6d, 0x6c, 0x7c, 0x39, 0x33, 0x62,
0x65, 0x63, 0x30, 0x39, 0x37, 0x37, 0x63, 0x66, 0x64, 0x33,
0x61, 0x31, 0x37, 0x2a, 0xef, 0x3, 0xea, 0x84, 0xef, 0xab,
0xa, 0xe8, 0x3, 0x8, 0x3, 0x12, 0x0, 0x2d, 0x0, 0x0,
0x0, 0x41, 0x32, 0xdc, 0x3, 0xfa, 0x3e, 0x4, 0x8, 0x5,
0x10, 0x1, 0x92, 0x3f, 0x4, 0xa, 0x2, 0x8, 0x1, 0xc2,
0xb8, 0x89, 0xbe, 0xa, 0x86, 0x1, 0xa, 0x81, 0x1, 0x38,
0x1, 0x40, 0x1, 0x50, 0x1, 0x58, 0x1, 0x60, 0x5, 0x78,
0x1, 0x80, 0x1, 0x1, 0x90, 0x1, 0x1, 0x98, 0x1, 0x1,
0xa0, 0x1, 0x1, 0xa8, 0x1, 0x1, 0xe0, 0x1, 0x1, 0x88,
0x2, 0x1, 0xa0, 0x2, 0x1, 0xd0, 0x2, 0x1, 0x98, 0x3,
0x1, 0xa0, 0x3, 0x1, 0xb0, 0x3, 0x1, 0xd0, 0x3, 0x1,
0xd8, 0x3, 0x1, 0xe8, 0x3, 0x1, 0xf0, 0x3, 0x1, 0x98,
0x4, 0x1, 0xd0, 0x4, 0x1, 0xe8, 0x4, 0x1, 0xf0, 0x4,
0x1, 0xf8, 0x4, 0x1, 0xd8, 0x5, 0x1, 0xe5, 0x5, 0xcd,
0xcc, 0x4c, 0x3f, 0xed, 0x5, 0xcd, 0xcc, 0x4c, 0x3f, 0xf5,
};
%hook YTIElementRenderer
- (NSData *)elementData {
NSString *description = [self description];
if ([description containsString:@"cell_divider"]) {
if (!cellDividerData) cellDividerData = %orig;
return cellDividerData;
}
// NSString *description = [self description];
if ([self respondsToSelector:@selector(hasCompatibilityOptions)] && self.hasCompatibilityOptions && self.compatibilityOptions.hasAdLoggingData) return cellDividerData;
return %orig;
}
Expand All @@ -869,10 +894,7 @@ NSData *cellDividerData;
YTIItemSectionSupportedRenderers *firstObject = [sectionRenderer.contentsArray firstObject];
YTIElementRenderer *elementRenderer = firstObject.elementRenderer;
NSString *description = [elementRenderer description];
return isAdString(description)
|| [description containsString:@"post_shelf"]
|| [description containsString:@"product_carousel"]
|| [description containsString:@"statement_banner"];
return isAdString(description);
}];
[contentsArray removeObjectsAtIndexes:removeIndexes];
}
Expand Down Expand Up @@ -2705,6 +2727,7 @@ BOOL selectedTabIndex = NO;
rebornHexColour = [unarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];
%init(gColourOptions);
}
cellDividerData = [NSData dataWithBytes:cellDividerDataBytes length:cellDividerDataBytesLength];
%init(_ungrouped);
}
}

0 comments on commit 7d11549

Please sign in to comment.