Reddit 过滤推广, 关 NSFW 提示(JQ 版)

先测测 晚点传文件再同步到 Surge.qingr.moe

支持 Surge 和 Loon

1. Surge 需此订阅功能 Body Rewrite 支持使用 JQ 表达式对 JSON 进行操作

🆕 以后仅更新此 📦 远程模块

将收录到 LoonKissSurge Repository

#!name=Reddit 去广告
#!desc=过滤推广, 关 NSFW 提示(JQ 版)
#!category=xream

[General]

force-http-engine-hosts = %APPEND% gql.reddit.com, gql-fed.reddit.com

[MITM]

hostname = %APPEND%, gql.reddit.com, gql-fed.reddit.com

[Body Rewrite]

http-response-jq ^https?:\/\/gql(-fed)?\.reddit\.com 'walk( if type == "object" then (if .isNsfw == true then .isNsfw = false else . end) | (if .isNsfwMediaBlocked == true then .isNsfwMediaBlocked = false else . end) | (if .isNsfwContentShown == false then .isNsfwContentShown = true else . end) | (if (.commentsPageAds | type == "array") then (.commentsPageAds = []) else . end) | (if ( (.node | type == "object") and (.node.cells | type == "array") and (.node.cells | any(.__typename? == "AdMetadataCell" or .isAdPost? == true)) ) then empty else . end) | (if (.node | type == "object") and (.node.adPayload | type == "object") then empty else . end) | (if .__typename == "AdPost" then empty else . end) else . end)'


2. Loon 需最新 TestFlight 版(现在好像会崩溃...等待确认)

#!name = Reddit 去广告
#!desc = 过滤推广, 关 NSFW 提示(JQ 版)
#!openUrl = https://apps.apple.com/app/id1064216828
#!author = xream[https://github.com/xream]
#!tag = 去广告
#!system = 
#!system_version = 
#!loon_version = 3.2.4(769)
#!homepage = https://github.com/luestr/ProxyResource/blob/main/README.md
#!icon = https://raw.githubusercontent.com/luestr/IconResource/main/App_icon/120px/Reddit.png
#!date = 2024-10-26 03:35:00

[Rewrite]
^https?:\/\/gql(-fed)?\.reddit\.com response-body-json-jq 'walk( if type == "object" then (if .isNsfw == true then .isNsfw = false else . end) | (if .isNsfwMediaBlocked == true then .isNsfwMediaBlocked = false else . end) | (if .isNsfwContentShown == false then .isNsfwContentShown = true else . end) | (if (.commentsPageAds | type == "array") then (.commentsPageAds = []) else . end) | (if ( (.node | type == "object") and (.node.cells | type == "array") and (.node.cells | any(.__typename? == "AdMetadataCell" or .isAdPost? == true)) ) then empty else . end) | (if (.node | type == "object") and (.node.adPayload | type == "object") then empty else . end) | (if .__typename == "AdPost" then empty else . end) else . end)'

[MitM]
hostname = gql.reddit.com, gql-fed.reddit.com


#Surge #Loon #模块 #Reddit #去广告 #广告 #JQ