From 48ad287200425474c25dbe40e2dd7eb826e3c9b7 Mon Sep 17 00:00:00 2001 From: Wangin1996 Date: Sun, 8 Mar 2026 17:23:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9A=90=E8=97=8F=E9=A1=B6?= =?UTF-8?q?=E6=A0=8F=E6=A8=AA=E7=BA=BF=EF=BC=8C=E4=BF=AE=E5=A4=8D=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E8=A7=86=E9=A2=91=E5=8F=91=E5=B8=83=E6=97=B6=E9=97=B4?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E8=BF=87=E6=BB=A4=E7=9B=B4=E6=92=AD?= =?UTF-8?q?HOOK=EF=BC=8C=E4=BF=AE=E6=94=B9=E8=BF=87=E6=BB=A4=E4=BD=8E?= =?UTF-8?q?=E8=B5=9EHOOK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AwemeHeaders.h | 13 +++ DYYY.xm | 245 +++++++++++++++++++++++++++++++++--------------- DYYYSettings.xm | 28 ++++-- 3 files changed, 204 insertions(+), 82 deletions(-) diff --git a/AwemeHeaders.h b/AwemeHeaders.h index 52f1e04e0..540124b54 100644 --- a/AwemeHeaders.h +++ b/AwemeHeaders.h @@ -1469,3 +1469,16 @@ typedef NS_ENUM(NSUInteger, DYEdgeMode) { @interface AWEDPlayerProgressContainerView : UIView @end + +// 精选标签 +@interface AWETemplateStaticLabelInfoModel : NSObject +@property (nonatomic, copy) NSArray *containers; +@end + +// 好友推荐 +@interface AFDFriendRecommendTagView : UIView +@end + +// 顶栏选中指示线 +@interface AWEFeedMultiTabSelectedContainerView : UIView +@end diff --git a/DYYY.xm b/DYYY.xm index 281c28ee9..f4b8a1c80 100644 --- a/DYYY.xm +++ b/DYYY.xm @@ -3690,13 +3690,10 @@ static NSHashTable *processedParentViews = nil; // 隐藏顶栏关注下的提示线 %hook AWEFeedMultiTabSelectedContainerView -- (void)setHidden:(BOOL)hidden { - BOOL forceHide = DYYYGetBool(@"DYYYHideTopBarLine"); - - if (forceHide) { - %orig(YES); - } else { - %orig(hidden); +- (void)layoutSubviews { + %orig; + if (DYYYGetBool(@"DYYYHideTopBarLine")) { + self.hidden = YES; } } @@ -3787,15 +3784,25 @@ static NSHashTable *processedParentViews = nil; %end // 隐藏关注直播 -%hook AWEConcernSkylightCapsuleView -- (void)setHidden:(BOOL)hidden { - if (DYYYGetBool(@"DYYYHideConcernCapsuleView")) { - %orig(YES); - return; - } +%hook AWELiveSkylightViewModel - %orig(hidden); +- (id)dataSource { + BOOL DYYYHideConcernCapsuleView = DYYYGetBool(@"DYYYHideConcernCapsuleView"); + if (DYYYHideConcernCapsuleView) { + return nil; + } + return %orig; } + +- (void)setDataSource:(id)dataSource { + BOOL DYYYHideConcernCapsuleView = DYYYGetBool(@"DYYYHideConcernCapsuleView"); + if (DYYYHideConcernCapsuleView) { + %orig(nil); + return; + } + %orig; +} + %end %hook AWELiveAutoEnterStyleAView @@ -3843,17 +3850,22 @@ static NSHashTable *processedParentViews = nil; %end -// 隐藏话题 -%hook AWEPlayInteractionTemplateButtonGroup -- (void)layoutSubviews { - if (DYYYGetBool(@"DYYYHideTemplateGroup")) { - UIView *parentView = self.superview; - if (parentView) { - [parentView removeFromSuperview]; - } - return; - } - %orig; +// 屏蔽模板按钮组件(底部互动)- hook button 方法返回 nil +%hook AWEPlayInteractionTemplateButton +- (id)button { + BOOL DYYYHideBottomInteraction = DYYYGetBool(@"DYYYHideBottomInteraction"); + if (DYYYHideBottomInteraction) { + return nil; + } + return %orig; +} + +- (void)setButton:(id)button { + BOOL DYYYHideBottomInteraction = DYYYGetBool(@"DYYYHideBottomInteraction"); + if (DYYYHideBottomInteraction) { + return; // 不设置按钮 + } + %orig; } %end @@ -3945,15 +3957,13 @@ static NSHashTable *processedParentViews = nil; // 隐藏首页直播胶囊 %hook AWEHPTopTabItemBadgeContentView - - (void)layoutSubviews { - %orig; - if (DYYYGetBool(@"DYYYHideLiveCapsuleView")) { + if (DYYYGetBool(@"DYYYHideConcernCapsuleView")) { self.hidden = YES; return; } + %orig; } - %end // 隐藏群商店 @@ -4075,19 +4085,6 @@ static NSHashTable *processedParentViews = nil; %end -// 隐藏顶栏红点 -%hook AWEHPTopTabItemBadgeContentView -- (id)showBadgeWithBadgeStyle:(NSUInteger)style badgeConfig:(id)config count:(NSInteger)count text:(id)text { - BOOL hideEnabled = DYYYGetBool(@"DYYYHideTopBarBadge"); - - if (hideEnabled) { - return nil; - } else { - return %orig(style, config, count, text); - } -} -%end - // 隐藏直播退出清屏、投屏按钮 %hook IESLiveButton @@ -4328,6 +4325,77 @@ static NSHashTable *processedParentViews = nil; } %end +// 推荐页过滤视频发布时间(数组级别过滤,属性已完整初始化) +%hook AWEHotListDataController + +- (id)transferAwemeListIfNeededWithArray:(id)arg1 isInitFetch:(BOOL)arg2 { + NSArray *orig = %orig; + if (!orig || orig.count == 0) return orig; + + // --- 配置读取 --- + NSInteger daysThreshold = DYYYGetInteger(@"DYYYFilterTimeLimit"); + BOOL skipLive = DYYYGetBool(@"DYYYSkipLive"); // 读取直播过滤开关 + NSInteger minLikesThreshold = DYYYGetInteger(@"DYYYFilterLowLikes"); // 读取低赞过滤阈值 (例如: 1000) + + NSTimeInterval now = [[NSDate date] timeIntervalSince1970]; + NSTimeInterval thresholdInSeconds = daysThreshold * 86400.0; + + NSMutableArray *filtered = [NSMutableArray arrayWithCapacity:orig.count]; + + for (id obj in orig) { + if (![obj isKindOfClass:%c(AWEAwemeModel)]) { + [filtered addObject:obj]; + continue; + } + + AWEAwemeModel *m = (AWEAwemeModel *)obj; + + // 1. 广告白名单 + // 使用 respondsToSelector 确保安全,防止属性变更 + if ([m respondsToSelector:@selector(isAds)] && m.isAds) { + [filtered addObject:obj]; + continue; + } + + // 2. 直播过滤逻辑 (仅依赖 cellRoom) + if (skipLive && [m respondsToSelector:@selector(cellRoom)] && m.cellRoom != nil) { + continue; // 命中直播过滤,跳过 + } + + // 3. 时间限制过滤 + if (daysThreshold > 0 && [m respondsToSelector:@selector(createTime)]) { + NSTimeInterval vTs = [m.createTime doubleValue]; + if (vTs > 1e12) vTs /= 1000.0; // 毫秒转秒 + + if (vTs > 0 && (now - vTs) > thresholdInSeconds) { + continue; // 超过设定时限,跳过 + } + } + + // 4. 低赞过滤逻辑 + if (minLikesThreshold > 0) { + NSInteger diggCount = 0; + // 抖音的点赞数通常在 statistics 模型中的 diggCount 属性里 + if ([m respondsToSelector:@selector(statistics)]) { + id stats = [m valueForKey:@"statistics"]; + if (stats && [stats respondsToSelector:@selector(diggCount)]) { + diggCount = [[stats valueForKey:@"diggCount"] integerValue]; + } + } + + if (diggCount < minLikesThreshold) { + continue; // 点赞数低于设定的阈值,跳过 + } + } + + [filtered addObject:obj]; + } + + return [filtered copy]; +} + +%end + %hook AWEAwemeModel - (id)initWithDictionary:(id)arg1 error:(id *)arg2 { @@ -4340,7 +4408,6 @@ static NSHashTable *processedParentViews = nil; %new - (BOOL)contentFilter { BOOL noAds = DYYYGetBool(@"DYYYNoAds"); - BOOL skipLive = DYYYGetBool(@"DYYYSkipLive"); BOOL skipAllLive = DYYYGetBool(@"DYYYSkipAllLive"); BOOL skipHotSpot = DYYYGetBool(@"DYYYSkipHotSpot"); BOOL skipPhoto = DYYYGetBool(@"DYYYSkipPhoto"); @@ -4349,7 +4416,6 @@ static NSHashTable *processedParentViews = nil; BOOL shouldFilterAds = noAds && (self.isAds); BOOL shouldFilterHotSpot = skipHotSpot && self.hotSpotLynxCardModel; - BOOL shouldFilterRecLive = skipLive && (self.cellRoom != nil); BOOL shouldFilterAllLive = skipAllLive && [self.videoFeedTag isEqualToString:@"直播中"]; BOOL shouldskipPhoto = skipPhoto && (self.awemeType == 68) && [self.referString isEqualToString:@"homepage_hot"]; BOOL shouldskipPhotoText = skipPhotoText && self.isNewTextMode && [self.referString isEqualToString:@"homepage_hot"]; @@ -4404,18 +4470,6 @@ static NSHashTable *processedParentViews = nil; // 只有当shareRecExtra不为空时才过滤点赞量低的视频和关键词 if ([self.referString isEqualToString:@"homepage_hot"]) { - NSInteger filterLowLikesThreshold = DYYYGetInteger(@"DYYYFilterLowLikes"); - // 过滤低点赞量视频 - if (filterLowLikesThreshold > 0) { - AWESearchAwemeExtraModel *searchExtraModel = [self searchExtraModel]; - if (!searchExtraModel) { - AWEAwemeStatisticsModel *statistics = self.statistics; - if (statistics && statistics.diggCount) { - shouldFilterLowLikes = statistics.diggCount.integerValue < filterLowLikesThreshold; - } - } - } - // 过滤包含特定关键词的视频 if (keywordsList.count > 0) { // 检查视频标题 @@ -4443,21 +4497,9 @@ static NSHashTable *processedParentViews = nil; } } } - - // 过滤视频发布时间 - long long currentTimestamp = (long long)[[NSDate date] timeIntervalSince1970]; - NSInteger daysThreshold = DYYYGetInteger(@"DYYYFilterTimeLimit"); - if (daysThreshold > 0) { - NSTimeInterval videoTimestamp = [self.createTime doubleValue]; - if (videoTimestamp > 0) { - NSTimeInterval threshold = daysThreshold * 86400.0; - NSTimeInterval current = (NSTimeInterval)currentTimestamp; - NSTimeInterval timeDifference = current - videoTimestamp; - shouldFilterTime = (timeDifference > threshold); - } - } } + // 检查是否为HDR视频 if (filterHDR && self.video && self.video.bitrateModels) { for (id bitrateModel in self.video.bitrateModels) { @@ -4471,7 +4513,7 @@ static NSHashTable *processedParentViews = nil; } } } - return shouldFilterAds || shouldFilterRecLive || shouldFilterAllLive || shouldFilterHotSpot || shouldskipPhoto || shouldskipPhotoText || shouldFilterHDR || shouldFilterLowLikes || shouldFilterKeywords || shouldFilterProp || + return shouldFilterAds || shouldFilterAllLive || shouldFilterHotSpot || shouldskipPhoto || shouldskipPhotoText || shouldFilterHDR || shouldFilterKeywords || shouldFilterProp || shouldFilterTime || shouldFilterUser; } @@ -4482,6 +4524,14 @@ static NSHashTable *processedParentViews = nil; return %orig; } +- (void)setEcommerceBelowLabel:(id)label { + if (DYYYGetBool(@"DYYYHideHisShop")) { + %orig(nil); + return; + } + %orig; +} + - (void)setDescriptionString:(NSString *)desc { NSString *labelStyle = [[NSUserDefaults standardUserDefaults] objectForKey:@"DYYYLabelStyle"]; BOOL hideLabel = [labelStyle isEqualToString:@"文案标签隐藏"]; @@ -4831,6 +4881,20 @@ static NSHashTable *processedParentViews = nil; //以下部分为新增 +// 屏蔽头像直播 +%hook AWEUserModel + +- (NSNumber *)roomID { + BOOL DYYYHideAvatarLive = DYYYGetBool(@"DYYYHideAvatarLive"); + if (DYYYHideAvatarLive) { + return @(0); + } + return %orig; +} + +%end + + // 屏蔽头像光圈 %hook AWEUserModel @@ -4912,20 +4976,18 @@ static NSHashTable *processedParentViews = nil; %end -// 屏蔽互动贴纸(复用挑战贴纸开关) +// 屏蔽互动贴纸 %hook AWEInteractionEditTagStickerModel - (id)editTagInfo { - BOOL DYYYHideChallengeStickers = DYYYGetBool(@"DYYYHideChallengeStickers"); - if (DYYYHideChallengeStickers) { + if (DYYYGetBool(@"DYYYHideEditTag")) { return nil; } return %orig; } - (void)setEditTagInfo:(id)info { - BOOL DYYYHideChallengeStickers = DYYYGetBool(@"DYYYHideChallengeStickers"); - if (DYYYHideChallengeStickers) { + if (DYYYGetBool(@"DYYYHideEditTag")) { %orig(nil); return; } @@ -5020,6 +5082,39 @@ static NSHashTable *processedParentViews = nil; %end +// 屏蔽精选标签 +%hook AWETemplateStaticLabelInfoModel + +- (NSArray *)containers { + if (DYYYGetBool(@"DYYYHideTemplateLabel")) { + return @[]; + } + return %orig; +} + +- (void)setContainers:(NSArray *)containers { + if (DYYYGetBool(@"DYYYHideTemplateLabel")) { + %orig(@[]); + return; + } + %orig; +} + +%end + +// 隐藏好友推荐 +%hook AFDFriendRecommendTagView + +- (void)layoutSubviews { + if (DYYYGetBool(@"DYYYHideFriendRecommend")) { + self.hidden = YES; + return; + } + %orig; +} + +%end + // 屏蔽汽水音乐锚点 - hook AWERelatedMusicAnchorModel %hook AWERelatedMusicAnchorModel diff --git a/DYYYSettings.xm b/DYYYSettings.xm index facbec3e4..d19b5dcd4 100644 --- a/DYYYSettings.xm +++ b/DYYYSettings.xm @@ -1112,6 +1112,11 @@ void showDYYYSettingsVC(UIViewController *rootVC, BOOL hasAgreed) { @"detail" : @"", @"cellType" : @6, @"imageName" : @"ic_eyeslash_outlined_16"}, + @{@"identifier" : @"DYYYHideAvatarLive", + @"title" : @"隐藏头像直播提示", + @"detail" : @"", + @"cellType" : @6, + @"imageName" : @"ic_eyeslash_outlined_16"}, @{@"identifier" : @"DYYYHideMusicButton", @"title" : @"隐藏音乐按钮", @"detail" : @"", @@ -1362,11 +1367,20 @@ void showDYYYSettingsVC(UIViewController *rootVC, BOOL hasAgreed) { @"detail" : @"", @"cellType" : @6, @"imageName" : @"ic_eyeslash_outlined_16"}, - @{@"identifier" : @"DYYYHideEditTags", - @"title" : @"隐藏图文标签", - @"subTitle" : @"隐藏图文中的自定义标签", + @{@"identifier" : @"DYYYHideEditTag", + @"title" : @"隐藏互动贴纸", @"detail" : @"", - @"cellType" : @37, + @"cellType" : @6, + @"imageName" : @"ic_eyeslash_outlined_16"}, + @{@"identifier" : @"DYYYHideTemplateLabel", + @"title" : @"隐藏精选标签", + @"detail" : @"", + @"cellType" : @6, + @"imageName" : @"ic_eyeslash_outlined_16"}, + @{@"identifier" : @"DYYYHideFriendRecommend", + @"title" : @"隐藏好友推荐", + @"detail" : @"", + @"cellType" : @6, @"imageName" : @"ic_eyeslash_outlined_16"}, @{@"identifier" : @"DYYYHideTemplateTags", @"title" : @"隐藏校园提示", @@ -1404,9 +1418,9 @@ void showDYYYSettingsVC(UIViewController *rootVC, BOOL hasAgreed) { @"cellType" : @6, @"imageName" : @"ic_eyeslash_outlined_16"}, @{ - @"identifier" : @"DYYYHideTemplateGroup", - @"title" : @"隐藏底部话题", - @"subTitle" : @"隐藏文案底部出现的话题", + @"identifier" : @"DYYYHideBottomInteraction", + @"title" : @"隐藏底部互动", + @"subTitle" : @"隐藏底部出现的分享等互动", @"detail" : @"", @"cellType" : @37, @"imageName" : @"ic_eyeslash_outlined_16"