Update AdBlock Workaround Option

ALT: Updated YouTube-X submodule
This commit is contained in:
arichornlover 2024-06-24 22:39:50 -05:00 committed by GitHub
parent 9eefece9d1
commit ebcdeb4c18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -129,53 +129,118 @@ NSBundle *tweakBundle = uYouPlusBundle();
%orig; %orig;
} }
%end %end
BOOL isAdString(NSString *description) { NSString *getAdString(NSString *description) {
if ([description containsString:@"brand_promo"] if ([description containsString:@"brand_promo"])
|| [description containsString:@"carousel_footered_layout"] return @"brand_promo";
|| [description containsString:@"carousel_headered_layout"] if ([description containsString:@"carousel_footered_layout"])
|| [description containsString:@"feed_ad_metadata"] return @"carousel_footered_layout";
|| [description containsString:@"full_width_portrait_image_layout"] if ([description containsString:@"carousel_headered_layout"])
|| [description containsString:@"full_width_square_image_layout"] return @"carousel_headered_layout";
|| [description containsString:@"home_video_with_context"] if ([description containsString:@"feed_ad_metadata"])
|| [description containsString:@"landscape_image_wide_button_layout"] return @"feed_ad_metadata";
|| [description containsString:@"post_shelf"] if ([description containsString:@"full_width_portrait_image_layout"])
|| [description containsString:@"product_carousel"] return @"full_width_portrait_image_layout";
|| [description containsString:@"product_engagement_panel"] if ([description containsString:@"full_width_square_image_layout"])
|| [description containsString:@"product_item"] return @"full_width_square_image_layout";
|| [description containsString:@"shelf_header"] if ([description containsString:@"landscape_image_wide_button_layout"])
|| [description containsString:@"statement_banner"] return @"landscape_image_wide_button_layout";
|| [description containsString:@"square_image_layout"] if ([description containsString:@"post_shelf"])
|| [description containsString:@"text_image_button_layout"] return @"post_shelf";
|| [description containsString:@"text_search_ad"] if ([description containsString:@"product_carousel"])
|| [description containsString:@"expandable_list"] return @"product_carousel";
|| [description containsString:@"expandable_metadata"] if ([description containsString:@"product_engagement_panel"])
|| [description containsString:@"video_display_full_layout"] return @"product_engagement_panel";
|| [description containsString:@"video_display_full_buttoned_layout"]) if ([description containsString:@"product_item"])
return YES; return @"product_item";
return NO; if ([description containsString:@"statement_banner"])
return @"statement_banner";
if ([description containsString:@"square_image_layout"])
return @"square_image_layout";
if ([description containsString:@"text_image_button_layout"])
return @"text_image_button_layout";
if ([description containsString:@"text_search_ad"])
return @"text_search_ad";
if ([description containsString:@"video_display_full_layout"])
return @"video_display_full_layout";
if ([description containsString:@"video_display_full_buttoned_layout"])
return @"video_display_full_buttoned_layout";
return nil;
} }
#define cellDividerDataBytesLength 720 #define cellDividerDataBytesLength 719
static __strong NSData *cellDividerData; static __strong NSData *cellDividerData;
static uint8_t cellDividerDataBytes[] = { static uint8_t cellDividerDataBytes[] = {
0xa, 0x8d, 0x5, 0xca, 0xeb, 0xea, 0x83, 0x5, 0x86, 0x5, 0xa, 0x8c, 0x5, 0xca, 0xeb, 0xea, 0x83, 0x5, 0x85, 0x5,
0x1a, 0x29, 0x92, 0xcb, 0xa1, 0x90, 0x5, 0x23, 0xa, 0x21, 0x1a, 0x29, 0x92, 0xcb, 0xa1, 0x90, 0x5, 0x23, 0xa, 0x21,
0x63, 0x65, 0x6c, 0x6c, 0x5f, 0x64, 0x69, 0x76, 0x69, 0x64, 0x63, 0x65, 0x6c, 0x6c, 0x5f, 0x64, 0x69, 0x76, 0x69, 0x64,
0x65, 0x72, 0x2e, 0x65, 0x6d, 0x6c, 0x7c, 0x39, 0x33, 0x62, 0x65, 0x72, 0x2e, 0x65, 0x6d, 0x6c, 0x7c, 0x39, 0x33, 0x62,
0x65, 0x63, 0x30, 0x39, 0x37, 0x37, 0x63, 0x66, 0x64, 0x33, 0x65, 0x63, 0x30, 0x39, 0x37, 0x37, 0x63, 0x66, 0x64, 0x33,
0x61, 0x31, 0x37, 0x2a, 0xef, 0x3, 0xea, 0x84, 0xef, 0xab, 0x61, 0x31, 0x37, 0x2a, 0xee, 0x3, 0xea, 0x84, 0xef, 0xab,
0xa, 0xe8, 0x3, 0x8, 0x3, 0x12, 0x0, 0x2d, 0x0, 0x0, 0xa, 0xe7, 0x3, 0x8, 0x4, 0x12, 0x0, 0x18, 0xff, 0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x37, 0x39, 0x38, 0x35, 0x39,
0x35, 0x34, 0x37, 0x39, 0x64, 0x62, 0x65, 0x36, 0x64, 0x63,
0x32, 0x67, 0x9a, 0xe8, 0xf9, 0xa9, 0x6, 0x8, 0x8, 0xcd,
0xf0, 0xbd, 0xa5, 0x1, 0x10, 0x7, 0xaa, 0xf1, 0xdf, 0xc1,
0xb, 0x24, 0xa, 0x1c, 0xa, 0x18, 0xa, 0x16, 0x74, 0x68,
0x65, 0x6d, 0x65, 0x7c, 0x66, 0x33, 0x33, 0x38, 0x61, 0x34,
0x35, 0x63, 0x38, 0x62, 0x66, 0x39, 0x30, 0x35, 0x66, 0x64,
0x10, 0x2, 0x10, 0xcd, 0xf0, 0xbd, 0xa5, 0x1, 0xb2, 0xf1,
0xdf, 0xc1, 0xb, 0x29, 0xa, 0x21, 0xa, 0x1d, 0x63, 0x61,
0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73,
0x7c, 0x61, 0x37, 0x39, 0x38, 0x35, 0x39, 0x35, 0x34, 0x37,
0x39, 0x64, 0x62, 0x65, 0x36, 0x64, 0x63, 0x10, 0xa, 0x10,
0xcd, 0xf0, 0xbd, 0xa5, 0x1, 0x12, 0x3e, 0xc2, 0x86, 0xa5,
0xbb, 0x5, 0x38, 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, 0x32, 0x13,
0x31, 0x37, 0x31, 0x39, 0x31, 0x32, 0x32, 0x35, 0x34, 0x39,
0x39, 0x39, 0x36, 0x30, 0x31, 0x37, 0x31, 0x33, 0x38,
}; };
%hook YTIElementRenderer %hook YTIElementRenderer
- (NSData *)elementData { - (NSData *)elementData {
@ -184,40 +249,19 @@ static uint8_t cellDividerDataBytes[] = {
return %orig; return %orig;
} }
%end %end
%hook YTInnerTubeCollectionViewController %hook YTIElementRenderer
- (void)loadWithModel:(YTISectionListRenderer *)model { - (NSData *)elementData {
if ([model isKindOfClass:%c(YTISectionListRenderer)]) { if ([self respondsToSelector:@selector(hasCompatibilityOptions)] && self.hasCompatibilityOptions && self.compatibilityOptions.hasAdLoggingData) {
NSMutableArray <YTISectionListSupportedRenderers *> *contentsArray = model.contentsArray; // HBLogInfo(@"YTX adLogging %@", cellDividerData);
NSIndexSet *removeIndexes = [contentsArray indexesOfObjectsPassingTest:^BOOL(YTISectionListSupportedRenderers *renderers, NSUInteger idx, BOOL *stop) { return cellDividerData;
if (![renderers isKindOfClass:%c(YTISectionListSupportedRenderers)])
return NO;
YTIItemSectionRenderer *sectionRenderer = renderers.itemSectionRenderer;
YTIItemSectionSupportedRenderers *firstObject = [sectionRenderer.contentsArray firstObject];
YTIElementRenderer *elementRenderer = firstObject.elementRenderer;
NSString *description = [elementRenderer description];
return isAdString(description);
}];
[contentsArray removeObjectsAtIndexes:removeIndexes];
} }
%orig; NSString *description = [self description];
} NSString *adString = getAdString(description);
%end if (adString) {
%hook YTWatchNextResultsViewController // HBLogInfo(@"YTX getAdString %@ %@", str, cellDividerData);
- (void)loadWithModel:(YTISectionListRenderer *)watchNextResults { return cellDividerData;
if ([watchNextResults isKindOfClass:%c(YTISectionListRenderer)]) {
NSMutableArray <YTISectionListSupportedRenderers *> *contentsArray = watchNextResults.contentsArray;
NSIndexSet *removeIndexes = [contentsArray indexesOfObjectsPassingTest:^BOOL(YTISectionListSupportedRenderers *renderers, NSUInteger idx, BOOL *stop) {
if (![renderers isKindOfClass:%c(YTISectionListSupportedRenderers)])
return NO;
YTIItemSectionRenderer *sectionRenderer = renderers.itemSectionRenderer;
YTIItemSectionSupportedRenderers *firstObject = [sectionRenderer.contentsArray firstObject];
YTIElementRenderer *elementRenderer = firstObject.elementRenderer;
NSString *description = [elementRenderer description];
return isAdString(description);
}];
[contentsArray removeObjectsAtIndexes:removeIndexes];
} }
%orig; return %orig;
} }
%end %end
%hook _ASDisplayView %hook _ASDisplayView