From 513941755300a0c6a1c3c7a2702859dc1ad5c0e8 Mon Sep 17 00:00:00 2001
From: blackmatrix7 <27717518+blackmatrix7@users.noreply.github.com>
Date: Thu, 30 Jun 2022 00:26:46 +0800
Subject: [PATCH] =?UTF-8?q?[=E7=9F=A5=E4=B9=8E=E5=8A=A9=E6=89=8B]=20?=
=?UTF-8?q?=E9=80=82=E9=85=8D=208.22.0(9926)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
script/zhihu/README.md | 32 +-
script/zhihu/pure/README.md | 22 +
script/zhihu/pure/zhihu_pure.lnplugin | 35 +
script/zhihu/pure/zhihu_pure.qxrewrite | 30 +
script/zhihu/pure/zhihu_pure.sgmodule | 33 +
script/zhihu/zhihu.js | 1010 ++++++++++++++++++++++++
script/zhihu/zhihu_lite.lnplugin | 19 +-
script/zhihu/zhihu_lite.qxrewrite | 20 +-
script/zhihu/zhihu_lite.sgmodule | 20 +-
script/zhihu/zhihu_plus.lnplugin | 34 +-
script/zhihu/zhihu_plus.qxrewrite | 32 +-
script/zhihu/zhihu_plus.sgmodule | 52 +-
script/zhihu/zhihu_remove_ads.list | 18 +-
13 files changed, 1253 insertions(+), 104 deletions(-)
create mode 100644 script/zhihu/pure/README.md
create mode 100644 script/zhihu/pure/zhihu_pure.lnplugin
create mode 100644 script/zhihu/pure/zhihu_pure.qxrewrite
create mode 100644 script/zhihu/pure/zhihu_pure.sgmodule
create mode 100644 script/zhihu/zhihu.js
diff --git a/script/zhihu/README.md b/script/zhihu/README.md
index 4668fd36b..c84f8a5c7 100644
--- a/script/zhihu/README.md
+++ b/script/zhihu/README.md
@@ -25,27 +25,28 @@
15. 客户端中显示自己是盐选会员
16. 直接运行脚本可清理客户端内持久化的数据
17. 部分功能支持BoxJS配置
-18. 付费内容文首提醒✨
-19. 推广内容文首提醒✨
+18. 推广/付费内容文首提醒✨
+20. 拦截部分回答预加载以节约流量✨
21. 去除官方账号的推广消息✨
-22. 去除推荐页中黑名单用户的回答✨
-23. 去除回答列表中黑名单用户的回答✨
+22. 去除推荐页和回答列表中黑名单用户的回答✨
24. 去除关注页顶部的最常访问✨
-25. 精简首页顶部的标签页✨
26. 屏蔽消息页面的知乎活动助手✨
27. 新旧版评论区黑名单用户过滤✨
28. 屏蔽转发的黑名单用户的想法✨
29. 推荐页屏蔽关键词解锁(支持正则)✨
-30. ~~知乎网页版去广告 [#21](https://github.com/blackmatrix7/ios_rule_script/issues/21)~~❓
+27. 精简知乎8.3.0版本推荐页顶部项 [#465](https://github.com/blackmatrix7/ios_rule_script/issues/465)✨
+28. 精简知乎6.x版本首页顶部的标签页✨
+30. ~~知乎网页版去广告~~ [#21](https://github.com/blackmatrix7/ios_rule_script/issues/21)❓
31. ~~去除热搜内的广告~~❓
-32. ~~屏蔽推荐页中的盐选推荐内容~~❓
33. ~~拦截知乎下发的配置,如皮肤(alpha)~~✨❓
34. ~~减少推荐页内的视频(alpha)~~✨❓
35. ~~去除推荐页的付费推荐内容~~✨❓
## 最近更新
-1. 适配至8.3.0 (8020)
+1. 适配至8.22.0 (9926)
+1. 去除视频标签页红点
+1. 增加知乎纯净版模块
## 版本切换
@@ -59,7 +60,7 @@
脚本的执行依赖于规则对`118.89.204.198`、`2402:4e00:1200:ed00:0:9089:6dac:96b6`两个IP地址的屏蔽。出现异常请先抓包确认上述两个地址的请求已经全部被正确拦截,无法屏蔽上述两个地址将导致所有功能失效!
-**知乎 8.3.0 (8020)版本**
+**知乎 8.3版本**
适配情况请访问:https://github.com/blackmatrix7/ios_rule_script/issues/465
@@ -138,7 +139,7 @@ Lite版本请确保所有Plus版本的选项都为关闭状态,以减少不必
使用模块
```ini
-https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_plus.sgmodule
+https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_plus.sgmodule
```
### Loon
@@ -147,7 +148,7 @@ https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhi
```ini
[Plugin]
-https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_plus.lnplugin, tag=知乎助手_去广告及体验增强, enabled=true
+https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_plus.lnplugin, tag=知乎助手_去广告及体验增强, enabled=true
```
### Quantumult X
@@ -159,7 +160,6 @@ https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhi
# 知乎去广告,以下规则请放置在filter_local最顶部
IP-CIDR,118.89.204.198/32,REJECT
IP6-CIDR,2402:4e00:1200:ed00:0:9089:6dac:96b6/128,REJECT
-HOST,118.89.204.198,REJECT
# 知乎去广告,以下规则的位置越前方越好
HOST,appcloud2.in.zhihu.com,REJECT
HOST,mqtt.zhihu.com,reject
@@ -167,7 +167,7 @@ HOST,sugar.zhihu.com,reject
USER-AGENT,AVOS*,REJECT
[rewrite_remote]
-https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_plus.qxrewrite, tag=知乎助手_去广告及体验增强, update-interval=86400, opt-parser=false, enabled=true
+https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_plus.qxrewrite, tag=知乎助手_去广告及体验增强, update-interval=86400, opt-parser=false, enabled=true
```
## 配置说明(Lite)
@@ -179,14 +179,14 @@ Plus版本功能较多,需要消耗较多的系统资源。如果出现VPN自
使用模块
```ini
-https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_lite.sgmodule
+https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_lite.sgmodule
```
### Loon
```ini
[Plugin]
-https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_lite.lnplugin, tag=知乎助手_去广告, enabled=true
+https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_lite.lnplugin, tag=知乎助手_去广告, enabled=true
```
#### Quantumult X
@@ -206,7 +206,7 @@ HOST,sugar.zhihu.com,reject
USER-AGENT,AVOS*,REJECT
[rewrite_remote]
-https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_lite.qxrewrite, tag=知乎助手_去广告, update-interval=86400, opt-parser=false, enabled=true
+https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_lite.qxrewrite, tag=知乎助手_去广告, update-interval=86400, opt-parser=false, enabled=true
```
## 其他问题
diff --git a/script/zhihu/pure/README.md b/script/zhihu/pure/README.md
new file mode 100644
index 000000000..bd8f15e1f
--- /dev/null
+++ b/script/zhihu/pure/README.md
@@ -0,0 +1,22 @@
+# 知乎纯净版
+
+## 前言
+
+新坑,尽量在不影响使用的前提下,屏蔽知乎APP更多的请求。
+
+起因是打算屏蔽知乎APP内的角标的等内容,这些基本都不是广告,不方便加入到知乎助手中强加给所有人,所以有了这个知乎纯净版。
+
+## 说明
+
+仅实现请求的拦截,不涉及脚本对请求的处理,不带MITM,需要配合知乎助手使用。
+
+很多请求,目前不清楚作用,经过简单测试拦截后并不影响知乎使用,所以把它们添加进来。但现阶段不影响使用不代表将来不影响使用,当前版本不影响使用不代表后续版本不影响使用,个人不影响使用不代表他人不影响使用。
+
+非必要不要使用这个模块,它未经严谨测试,可能会带来功能异常、卡顿、发热、请求风暴等等。
+
+## 链接
+
+比较懒就不写了吧。
+
+
+
diff --git a/script/zhihu/pure/zhihu_pure.lnplugin b/script/zhihu/pure/zhihu_pure.lnplugin
new file mode 100644
index 000000000..f97c828ae
--- /dev/null
+++ b/script/zhihu/pure/zhihu_pure.lnplugin
@@ -0,0 +1,35 @@
+# 知乎纯净版,屏蔽更多请求,需搭配知乎助手使用
+
+[Rule]
+DOMAIN,zhihu-web-analytics.zhihu.com,REJECT
+
+
+[URL Rewrite]
+# 屏蔽知乎8.3.0版本首页顶部的视频角标
+^https?:\/\/api\.zhihu\.com\/explore\/entry\/tips - reject
+# 屏蔽正在发生
+^https:\/\/api\.zhihu\.com\/feed-root\/happening - reject
+# 可能是内购之类的
+^https:\/\/api\.zhihu\.com\/order\/v1\/records\/iap - reject
+# 可能是某些通知相关的配置
+^https?:\/\/api\.zhihu\.com\/settings\/new\/notification - reject
+# 不清楚作用,屏蔽暂时不影响正常运行
+^https:\/\/api\.zhihu\.com\/zst\/events\/s - reject
+^https:\/\/api\.zhihu\.com\/account\/attach_info - reject
+^https:\/\/api\.zhihu\.com\/slytherin\/plus_panel_v2 - reject
+^https:\/\/api\.zhihu\.com\/creator_board - reject
+^https:\/\/api\.zhihu\.com\/account\/toggle - reject
+^https:\/\/api\.zhihu\.com\/market\/popovers_v2 - reject
+^https:\/\/api\.zhihu\.com\/api\/v4\/member\/login\/record - reject
+^https:\/\/api\.zhihu\.com\/versioning\/ironman\/latest\? - reject
+^https:\/\/appcloud2\.zhihu\.com\/v3\/resource - reject
+^https:\/\/api\.zhihu\.com\/usertask-core\/action\/read_content - reject
+^https:\/\/www\.zhihu\.com\/api\/v4\/mcn\/goods\/incontent - reject
+^https:\/\/zhuanlan\.zhihu\.com\/check_health - reject
+^https:\/\/api\.zhihu\.com\/check_health - reject
+^https:\/\/www\.zhihu\.com\/check_health - reject
+^https:\/\/api\.zhihu\.com\/pluton_v2\/qa_recommend\/card - reject
+^https:\/\/www\.zhihu\.com\/sc-profiler - reject
+^https:\/\/api\.zhihu\.com\/zst\/events\/p - reject
+# ^https:\/\/api\.zhihu\.com\/pluton\/ab\? - reject
+# ^https:\/\/api\.zhihu\.com\/poisson\/flow\/free - reject
\ No newline at end of file
diff --git a/script/zhihu/pure/zhihu_pure.qxrewrite b/script/zhihu/pure/zhihu_pure.qxrewrite
new file mode 100644
index 000000000..f3d29fa9c
--- /dev/null
+++ b/script/zhihu/pure/zhihu_pure.qxrewrite
@@ -0,0 +1,30 @@
+# 知乎纯净版,屏蔽更多请求,需搭配知乎助手使用
+
+# 屏蔽知乎8.3.0版本首页顶部的视频角标
+^https?:\/\/api\.zhihu\.com\/explore\/entry\/tips url reject
+# 屏蔽正在发生
+^https:\/\/api\.zhihu\.com\/feed-root\/happening url reject
+# 可能是内购之类的
+^https:\/\/api\.zhihu\.com\/order\/v1\/records\/iap url reject
+# 可能是某些通知相关的配置
+^https?:\/\/api\.zhihu\.com\/settings\/new\/notification url reject
+# 不清楚作用,屏蔽暂时不影响正常运行
+^https:\/\/api\.zhihu\.com\/zst\/events\/s url reject
+^https:\/\/api\.zhihu\.com\/account\/attach_info url reject
+^https:\/\/api\.zhihu\.com\/slytherin\/plus_panel_v2 url reject
+^https:\/\/api\.zhihu\.com\/creator_board url reject
+^https:\/\/api\.zhihu\.com\/account\/toggle url reject
+^https:\/\/api\.zhihu\.com\/market\/popovers_v2 url reject
+^https:\/\/api\.zhihu\.com\/api\/v4\/member\/login\/record url reject
+^https:\/\/api\.zhihu\.com\/versioning\/ironman\/latest\? url reject
+^https:\/\/appcloud2\.zhihu\.com\/v3\/resource url reject
+^https:\/\/api\.zhihu\.com\/usertask-core\/action\/read_content url reject
+^https:\/\/www\.zhihu\.com\/api\/v4\/mcn\/goods\/incontent url reject
+^https:\/\/zhuanlan\.zhihu\.com\/check_health url reject
+^https:\/\/api\.zhihu\.com\/check_health url reject
+^https:\/\/www\.zhihu\.com\/check_health url reject
+^https:\/\/api\.zhihu\.com\/pluton_v2\/qa_recommend\/card url reject
+^https:\/\/www\.zhihu\.com\/sc-profiler url reject
+^https:\/\/api\.zhihu\.com\/zst\/events\/p url reject
+^https:\/\/api\.zhihu\.com\/pluton\/ab\? url reject
+# ^https:\/\/api\.zhihu\.com\/poisson\/flow\/free url reject
\ No newline at end of file
diff --git a/script/zhihu/pure/zhihu_pure.sgmodule b/script/zhihu/pure/zhihu_pure.sgmodule
new file mode 100644
index 000000000..e3a0a4b18
--- /dev/null
+++ b/script/zhihu/pure/zhihu_pure.sgmodule
@@ -0,0 +1,33 @@
+#!name=知乎
+#!desc=知乎纯净版,屏蔽更多请求,需搭配知乎助手使用
+
+[Rule]
+# 屏蔽知乎8.3.0版本首页顶部的视频角标
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/explore\/entry\/tips,REJECT-TINYGIF
+# 屏蔽正在发生
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/feed-root\/happening,REJECT-TINYGIF
+# 可能是内购之类的
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/order\/v1\/records\/iap,REJECT-TINYGIF
+# 可能是某些通知相关的配置
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/settings\/new\/notification,REJECT-TINYGIF
+# 不清楚作用,屏蔽暂时不影响正常运行
+DOMAIN,zhihu-web-analytics.zhihu.com,REJECT,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/zst\/events\/s,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/account\/attach_info,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/slytherin\/plus_panel_v2,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/creator_board,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/account\/toggle,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/market\/popovers_v2,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/api\/v4\/member\/login\/record,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/versioning\/ironman\/latest\?,REJECT-TINYGIF
+URL-REGEX,^https:\/\/appcloud2\.zhihu\.com\/v3\/resource,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/usertask-core\/action\/read_content,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/api\/v4\/mcn\/goods\/incontent,REJECT-TINYGIF
+URL-REGEX,^https:\/\/zhuanlan\.zhihu\.com\/check_health,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/check_health,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/check_health,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/pluton_v2\/qa_recommend\/card,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/sc-profiler,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/zst\/events\/p,REJECT-TINYGIF
+# URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/pluton\/ab\?,REJECT-TINYGIF
+# URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/poisson\/flow\/free,REJECT-TINYGIF
\ No newline at end of file
diff --git a/script/zhihu/zhihu.js b/script/zhihu/zhihu.js
new file mode 100644
index 000000000..4c30ed26f
--- /dev/null
+++ b/script/zhihu/zhihu.js
@@ -0,0 +1,1010 @@
+const scriptName = "知乎助手";
+const blockedUsersKey = "zhihu_blocked_users";
+const currentUserInfoKey = "zhihu_current_userinfo";
+const keywordBlockKey = "zhihu_keyword_block";
+// 默认屏蔽推荐列表的用户,通常不是真实用户,无法通过加入黑名单屏蔽
+const defaultAnswerBlockedUsers = ["会员推荐"];
+const keywordMaxCount = 1000; // 允许设置的关键词数量
+let magicJS = MagicJS(scriptName, "INFO");
+
+(() => {
+ let response = null;
+ if (magicJS.isResponse) {
+ switch (true) {
+ // 知乎8.3.0移除推荐页顶部项
+ case magicJS.read("zhihu_settings_remove_sections") == true && /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/feed-root\/sections\/query\/v2/.test(magicJS.request.url):
+ response = removeFeedSections();
+ break;
+ // 回答内容优化
+ case magicJS.read("zhihu_settings_answer_tip") != false &&
+ /^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/appview\/v2\/answer\/.*(entry=(?!(preload-topstory|preload-search|preload-subscription)))?/.test(magicJS.request.url):
+ response = modifyAnswer();
+ break;
+ // 处理登录用户信息
+ case /^https:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/people\/self/.test(magicJS.request.url):
+ response = processUserInfo();
+ break;
+ // 黑名单增强 - 浏览黑名单用户信息时自动加入脚本黑名单
+ case magicJS.read("zhihu_settings_blocked_users") != false && /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/people\/((?!self).)*$/.test(magicJS.request.url):
+ response = autoInsertBlackList();
+ break;
+ // 推荐去广告与黑名单增强
+ case /^https:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/topstory\/recommend\?/.test(magicJS.request.url):
+ response = removeRecommendAds();
+ break;
+ // 关注列表去广告
+ case /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/moments(\/|\?)?(recommend|action=|feed_type=)(?!\/people)/.test(magicJS.request.url):
+ response = removeMomentsAds();
+ break;
+ // 回答列表去广告与黑名单增强
+ case /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/(v4\/)?questions\/\d+/.test(magicJS.request.url):
+ response = removeQuestionsAds();
+ break;
+ // 知乎V5版本评论去广告及黑名单增强
+ case /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/comment_v5\/(answers|pins|comments?|articles)\/\d+\/(root|child)_comment/.test(magicJS.request.url):
+ response = removeCommentV5Ads();
+ break;
+ // 知乎旧版回答中的评论黑名单增强
+ case /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/(answers|pins|comments?|articles)\/\d+\/(root|child)_comments/.test(magicJS.request.url):
+ response = removeCommentAds();
+ break;
+ // 知乎热榜去广告
+ case magicJS.read("zhihu_settings_hot_list") != false && /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/topstory\/hot-lists?(\?|\/)/.test(magicJS.request.url):
+ response = removeHotListAds();
+ break;
+ // 拦截官方账号推广消息
+ case magicJS.read("zhihu_settings_sys_msg") != false && /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/notifications\/v3\/timeline\/entry\/system_message/.test(magicJS.request.url):
+ response = removeSysMsgAds();
+ break;
+ // 屏蔽官方营销消息
+ case magicJS.read("zhihu_settings_sys_msg") != false && /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/notifications\/v3\/message/.test(magicJS.request.url):
+ response = removeMarketingMsg();
+ break;
+ // 去除预置关键字广告
+ case magicJS.read("zhihu_settings_preset_words") == true && /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/search\/preset_words\?/.test(magicJS.request.url):
+ response = removeKeywordAds();
+ break;
+ // 优化知乎软件配置
+ case magicJS.read("zhihu_settings_app_conf") == true && /^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config/.test(magicJS.request.url):
+ response = modifyAppConfig();
+ break;
+ // 知乎热搜去广告
+ case magicJS.read("zhihu_settings_hot_search") == true && /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/search\/top_search\/tabs\/hot\/items/.test(magicJS.request.url):
+ response = removeHotSearchAds();
+ break;
+ // 黑名单管理
+ case magicJS.read("zhihu_settings_blocked_users") != false && /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/settings\/blocked_users/.test(magicJS.request.url):
+ manageBlackUser();
+ break;
+ default:
+ break;
+ }
+ } else if (magicJS.isRequest) {
+ // 知乎屏蔽关键词解锁
+ if (magicJS.read("zhihu_settings_blocked_keywords") != false && /^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/feed-root\/block/.test(magicJS.request.url) === true) {
+ response = unlockBlockedKeywords(response);
+ }
+ } else {
+ magicJS.write(currentUserInfoKey, "");
+ magicJS.write(blockedUsersKey, "");
+ magicJS.write(keywordBlockKey, "");
+ magicJS.notify("知乎助手数据清理完毕");
+ }
+ if (response) {
+ magicJS.done(response);
+ } else {
+ magicJS.done();
+ }
+})();
+
+/**
+ * 屏蔽官方营销消息
+ *
+ * @param {*}
+ * @return {*}
+ */
+function removeMarketingMsg() {
+ let response = null;
+ try {
+ let obj = JSON.parse(magicJS.response.body);
+ let newItems = [];
+ for (let item of obj["data"]) {
+ if (item["detail_title"] === "官方帐号消息") {
+ let unread_count = item["unread_count"];
+ if (unread_count > 0) {
+ item["content"]["text"] = "未读消息" + unread_count + "条";
+ } else {
+ item["content"]["text"] = "全部消息已读";
+ }
+ item["is_read"] = true;
+ item["unread_count"] = 0;
+ newItems.push(item);
+ } else if (item["detail_title"] !== "知乎活动助手") {
+ newItems.push(item);
+ }
+ }
+ obj["data"] = newItems;
+ response = { body: JSON.stringify(obj) };
+ } catch (err) {
+ magicJS.logError(`知乎屏蔽官方营销消息出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 知乎屏蔽关键词解锁
+ *
+ * @param {*}
+ * @return {*}
+ */
+function unlockBlockedKeywords() {
+ let response = null;
+ try {
+ const userInfo = getUserInfo();
+ // 获取屏蔽关键词列表
+ if (magicJS.request.method === "GET") {
+ let keywords = magicJS.read(keywordBlockKey, userInfo.id);
+ if (!keywords) {
+ keywords = [];
+ }
+ let headers = {
+ "Cache-Control": "no-cache, no-store, must-revalidate, private, max-age=0",
+ "Connection": "keep-alive",
+ "Content-Type": "application/json;charset=utf-8",
+ "Pragma": "no-cache",
+ "Referrer-Policy": "no-referrer-when-downgrade",
+ "Server": "CLOUD ELB 1.0.0",
+ "Vary": "Accept-Encoding",
+ "X-Cache-Lookup": "Cache Miss",
+ "x-cdn-provider": "tencent",
+ };
+ let body = JSON.stringify({
+ success: true,
+ is_vip: true,
+ kw_min_length: 2,
+ kw_max_length: 100,
+ kw_max_count: keywordMaxCount,
+ data: keywords,
+ });
+ if (magicJS.isQuanX) {
+ response = { body: body, headers: headers, status: "HTTP/1.1 200 OK" };
+ } else {
+ response = { response: { body: body, headers: headers, status: 200 } };
+ }
+ magicJS.logDebug(`获取本地脚本屏蔽关键词:\n${keywords.join("、")}`);
+ }
+
+ // 添加屏蔽关键词
+ else if (magicJS.request.method === "POST") {
+ if (!!magicJS.request.body) {
+ // 构造 response headers
+ let headers = {
+ "Cache-Control": "no-cache, no-store, must-revalidate, private, max-age=0",
+ "Connection": "keep-alive",
+ "Content-Type": "application/json;charset=utf-8",
+ "Pragma": "no-cache",
+ "Referrer-Policy": "no-referrer-when-downgrade",
+ "Server": "CLOUD ELB 1.0.0",
+ "Vary": "Accept-Encoding",
+ "X-Cache-Lookup": "Cache Miss",
+ "x-cdn-provider": "tencent",
+ };
+ // 读取关键词
+ let keyword = decodeURIComponent(magicJS.request.body).match(/keyword=(.*)/)[1];
+ let keywords = magicJS.read(keywordBlockKey, userInfo.id);
+ if (!keywords) {
+ keywords = [];
+ }
+ // 判断关键词是否存在
+ let keywordExists = false;
+ for (let i = 0; i < keywords.length; i++) {
+ if (keyword === keywords[i]) {
+ keywordExists = true;
+ }
+ }
+ // 不存在添加,存在返回异常
+ if (keywordExists === false) {
+ keywords.push(keyword);
+ magicJS.write(keywordBlockKey, keywords, userInfo.id);
+ let body = JSON.stringify({ success: true });
+ if (magicJS.isQuanX) {
+ response = { body: body, headers: headers, status: "HTTP/1.1 200 OK" };
+ } else {
+ response = { response: { body: body, headers: headers, status: 200 } };
+ }
+ magicJS.logDebug(`添加本地脚本屏蔽关键词“${keyword}”`);
+ } else {
+ let body = JSON.stringify({
+ error: {
+ message: "关键词已存在",
+ code: 100002,
+ },
+ });
+ if (magicJS.isQuanX) {
+ response = {
+ body: body,
+ headers: headers,
+ status: "HTTP/1.1 400 Bad Request",
+ };
+ } else {
+ response = { response: { body: body, headers: headers, status: 400 } };
+ }
+ }
+ }
+ }
+
+ // 删除屏蔽关键词
+ else if (magicJS.request.method === "DELETE") {
+ let keyword = decodeURIComponent(magicJS.request.url).match(/keyword=(.*)/)[1];
+ let keywords = magicJS.read(keywordBlockKey, userInfo.id);
+ if (!keywords) {
+ keywords = [];
+ }
+ keywords = keywords.filter((e) => {
+ return e != keyword;
+ });
+ magicJS.write(keywordBlockKey, keywords, userInfo.id);
+ let headers = {
+ "Cache-Control": "no-cache, no-store, must-revalidate, private, max-age=0",
+ "Connection": "keep-alive",
+ "Content-Type": "application/json;charset=utf-8",
+ "Pragma": "no-cache",
+ "Referrer-Policy": "no-referrer-when-downgrade",
+ "Server": "CLOUD ELB 1.0.0",
+ "Vary": "Accept-Encoding",
+ "X-Cache-Lookup": "Cache Miss",
+ "x-cdn-provider": "tencent",
+ };
+ let body = JSON.stringify({ success: true });
+ if (magicJS.isQuanX) {
+ response = { body: body, headers: headers, status: "HTTP/1.1 200 OK" };
+ } else {
+ response = { response: { body: body, headers: headers, status: 200 } };
+ }
+ magicJS.logDebug(`删除本地脚本屏蔽关键词:“${keyword}”`);
+ }
+ } catch (err) {
+ magicJS.logError(`知乎关键词屏蔽操作出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 知乎热搜去广告
+ *
+ * @param {*}
+ * @return {*}
+ */
+function removeHotSearchAds() {
+ let response = null;
+ try {
+ if (!!magicJS.response.body) {
+ let obj = JSON.parse(magicJS.response.body);
+ obj["commercial_data"] = [];
+ response = { body: JSON.stringify(obj) };
+ }
+ } catch (err) {
+ magicJS.logError(`去除知乎热搜广告出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 优化知乎软件配置
+ *
+ * @param {*}
+ * @return {*}
+ */
+function modifyAppConfig() {
+ let response = null;
+ try {
+ if (!!magicJS.response.body) {
+ let obj = JSON.parse(magicJS.response.body);
+ let tab_infos = obj["config"]["homepage_feed_tab"]["tab_infos"].filter((e) => {
+ if (e.tab_type === "activity_tab") {
+ e.end_time = (Date.parse(new Date()) - 120000).toString().substr(0, 10);
+ return true;
+ } else {
+ return false;
+ }
+ });
+ obj["config"]["homepage_feed_tab"]["tab_infos"] = tab_infos;
+ obj["config"]["zvideo_max_number"] = 1;
+ // 试着去除一些配置,效果待验证
+ delete obj["config"]["soso_des"];
+ delete obj["config"]["cronet"];
+ // 屏蔽知乎8.X版本以上本地DNS解析,以下修改不清楚哪些是有效的,暂时全部保留
+ if (obj["config"].hasOwnProperty("zhcnh_thread_sync")) {
+ magicJS.logDebug(JSON.stringify(obj["config"]["zhcnh_thread_sync"]));
+ obj["config"]["zhcnh_thread_sync"]["LocalDNSSetHostWhiteList"] = [];
+ obj["config"]["zhcnh_thread_sync"]["isOpenLocalDNS"] = "0";
+ obj["config"]["zhcnh_thread_sync"]["ZHBackUpIP_Switch_Open"] = "0";
+ obj["config"]["zhcnh_thread_sync"]["dns_ip_detector_operation_lock"] = "1";
+ obj["config"]["zhcnh_thread_sync"]["ZHHTTPSessionManager_setupZHHTTPHeaderField"] = "1";
+ }
+ response = { body: JSON.stringify(obj) };
+ }
+ } catch (err) {
+ magicJS.logError(`优化知乎软件配置出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 去除预置关键字广告
+ *
+ * @param {*}
+ * @return {*}
+ */
+function removeKeywordAds() {
+ let response = null;
+ try {
+ if (!!magicJS.response.body) {
+ magicJS.logDebug(`预置关键字返回:${magicJS.response.body}`);
+ let obj = JSON.parse(magicJS.response.body);
+ if (obj.hasOwnProperty("preset_words") && obj["preset_words"]["words"]) {
+ let words = obj["preset_words"]["words"].filter((element) => {
+ return element["type"] !== "ad";
+ });
+ obj["preset_words"]["words"] = words;
+ response = { body: JSON.stringify(obj) };
+ }
+ }
+ } catch (err) {
+ magicJS.logError(`知乎去除预置关键字广告出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 拦截官方账号推广消息
+ *
+ * @param {*}
+ * @return {*}
+ */
+function removeSysMsgAds() {
+ let response = null;
+ try {
+ const sysmsg_blacklist = ["知乎小伙伴", "知乎视频", "知乎团队", "知乎礼券", "知乎读书会团队"];
+ let obj = JSON.parse(magicJS.response.body);
+ let data = obj["data"].filter((element) => {
+ return sysmsg_blacklist.indexOf(element["content"]["title"]) < 0;
+ });
+ obj["data"] = data;
+ response = { body: JSON.stringify(obj) };
+ } catch (err) {
+ magicJS.logError(`知乎拦截官方账号推广消息出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 知乎热榜去广告
+ *
+ * @param {*}
+ * @return {*}
+ */
+function removeHotListAds() {
+ let response = null;
+ try {
+ if (!!magicJS.response.body) {
+ let obj = JSON.parse(magicJS.response.body);
+ let data = obj["data"].filter((e) => {
+ return e["type"] === "hot_list_feed" || e["type"] === "hot_list_feed_video";
+ });
+ obj["data"] = data;
+ response = { body: JSON.stringify(obj) };
+ }
+ } catch (err) {
+ magicJS.logError(`去除知乎热搜广告出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 知乎旧版回答中的评论黑名单增强
+ *
+ * @param {*}
+ * @return {*}
+ */
+function removeCommentAds() {
+ let response = null;
+ try {
+ if (!!magicJS.response.body) {
+ // 评论区去广告
+ let obj = JSON.parse(magicJS.response.body);
+ if (magicJS.read("zhihu_settings_blocked_users") != false) {
+ // 屏蔽黑名单用户
+ let user_info = getUserInfo();
+ let customBlockedUsers = magicJS.read(blockedUsersKey, user_info.id);
+ let newData = [];
+ obj.data.forEach((comment) => {
+ // 评论人昵称
+ let commentUserName = comment.author.member.name;
+ // 回复哪个人的评论(仅适用于独立子评论页面请求)
+ let replyUserName = "";
+ if (comment.reply_to_author && comment.reply_to_author.member && comment.reply_to_author.member.name) {
+ replyUserName = comment.reply_to_author.member.name;
+ }
+ if (customBlockedUsers[commentUserName] || customBlockedUsers[replyUserName]) {
+ if (customBlockedUsers[commentUserName] && !replyUserName && magicJS.request.url.indexOf("root_comment") > 0) {
+ magicJS.notifyDebug(`屏蔽黑名单用户“${commentUserName}”的主评论。`);
+ } else if (customBlockedUsers[commentUserName] && !replyUserName && magicJS.request.url.indexOf("child_comment") > 0) {
+ magicJS.notifyDebug(`屏蔽黑名单用户“${commentUserName}”的子评论。`);
+ } else if (customBlockedUsers[commentUserName] && replyUserName && magicJS.request.url.indexOf("child_comment") > 0) {
+ magicJS.notifyDebug(`屏蔽黑名单用户“${commentUserName}”回复“${replyUserName}”的子评论。`);
+ } else {
+ magicJS.notifyDebug(`屏蔽“${commentUserName}”回复黑名单用户“${replyUserName}”的子评论。`);
+ }
+ // 减少主评论页面中的评论总数(仅适用于独立的主评论页面请求)
+ if (obj.common_counts) {
+ obj.common_counts -= 1;
+ }
+ // 减少子评论页面中的评论总数(仅适用于独立子评论页面请求)
+ if (obj.paging && obj.paging.totals) {
+ obj.paging.totals -= 1;
+ }
+ } else {
+ // 屏蔽子评论中的黑名单用户(仅适用于独立的主评论页面请求)
+ if (comment.child_comments) {
+ let newChildComments = [];
+ comment.child_comments.forEach((childComment) => {
+ if (customBlockedUsers[childComment.author.member.name] || customBlockedUsers[childComment.reply_to_author.member.name]) {
+ if (customBlockedUsers[childComment.author.member.name]) {
+ magicJS.notifyDebug(`屏蔽黑名单用户“${childComment.author.member.name}”的主评论。`);
+ } else {
+ magicJS.notifyDebug(`屏蔽“${childComment.author.member.name}”回复黑名单用户“${childComment.reply_to_author.member.name}”的子评论。`);
+ }
+ comment.child_comment_count -= 1;
+ } else {
+ newChildComments.push(childComment);
+ }
+ });
+ comment.child_comments = newChildComments;
+ }
+ newData.push(comment);
+ }
+ });
+ obj.data = newData;
+ }
+ response = { body: JSON.stringify(obj) };
+ }
+ } catch (err) {
+ magicJS.logError(`去除知乎评论广告出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 知乎V5版本评论去广告及黑名单增强
+ *
+ * @param {*}
+ * @return {*}
+ */
+function removeCommentV5Ads() {
+ let response = null;
+ try {
+ if (!!magicJS.response.body) {
+ let obj = JSON.parse(magicJS.response.body);
+ obj["ad_info"] = {};
+ // 屏蔽黑名单用户
+ if (magicJS.read("zhihu_settings_blocked_users") != false) {
+ let user_info = getUserInfo();
+ let customBlockedUsers = magicJS.read(blockedUsersKey, user_info.id);
+ customBlockedUsers = !!customBlockedUsers ? customBlockedUsers : {};
+ let newComments = [];
+ let blockCommentIdObj = {};
+ obj.data.forEach((comment) => {
+ // 评论人昵称
+ let commentUserName = comment.author.name;
+ // 回复哪个人的评论(仅适用于独立子评论页面请求)
+ let replyUserName = "";
+ if (comment.reply_to_author && comment.reply_to_author && comment.reply_to_author.name) {
+ replyUserName = comment.reply_to_author.name;
+ }
+ if (customBlockedUsers[commentUserName] || customBlockedUsers[replyUserName]) {
+ if (customBlockedUsers[commentUserName] && !replyUserName && magicJS.request.url.indexOf("root_comment") > 0) {
+ magicJS.notifyDebug(`屏蔽黑名单用户“${commentUserName}”的主评论。`);
+ } else if (customBlockedUsers[commentUserName] && !replyUserName && magicJS.request.url.indexOf("child_comment") > 0) {
+ magicJS.notifyDebug(`屏蔽黑名单用户“${commentUserName}”的子评论。`);
+ } else if (customBlockedUsers[commentUserName] && replyUserName && magicJS.request.url.indexOf("child_comment") > 0) {
+ magicJS.notifyDebug(`屏蔽黑名单用户“${commentUserName}”回复“${replyUserName}”的子评论。`);
+ } else {
+ magicJS.notifyDebug(`屏蔽“${commentUserName}”回复黑名单用户“${replyUserName}”的子评论。`);
+ }
+ blockCommentIdObj[comment.id] = commentUserName;
+ // 主评论数量-1,仅适用于root_comment主评论页面请求
+ if (obj.counts && obj.counts.total_counts) {
+ obj.counts.total_counts -= 1;
+ }
+ // 子评论数量-1,仅适用于child_comment子评论页面请求
+ if (obj.paging && obj.paging.totals) {
+ obj.paging.totals -= 1;
+ }
+ if (obj.root && obj.root.child_comment_count) {
+ obj.root.child_comment_count -= 1;
+ }
+ } else {
+ if (comment.child_comments) {
+ let newChildComments = [];
+ comment.child_comments.forEach((childComment) => {
+ let childCommentUserName = childComment.author.name;
+ if (customBlockedUsers[childCommentUserName] || blockCommentIdObj[childComment.reply_comment_id]) {
+ if (customBlockedUsers[childCommentUserName]) {
+ magicJS.notifyDebug(`屏蔽黑名单用户“${childCommentUserName}”的子评论。`);
+ blockCommentIdObj[childComment.id] = childCommentUserName;
+ } else {
+ magicJS.notifyDebug(`屏蔽“${childCommentUserName}”回复黑名单用户“${blockCommentIdObj[childComment.reply_comment_id]}”的子评论。`);
+ }
+ comment.child_comment_count -= 1;
+ } else {
+ newChildComments.push(childComment);
+ }
+ });
+ comment.child_comments = newChildComments;
+ }
+ newComments.push(comment);
+ }
+ });
+ obj.data = newComments;
+ }
+ response = { body: JSON.stringify(obj) };
+ }
+ } catch (err) {
+ magicJS.logError(`去除知乎评论广告出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 回答列表去广告与黑名单增强
+ *
+ * @param {*}
+ * @return {*}
+ */
+function removeQuestionsAds() {
+ let response = null;
+ try {
+ const userInfo = getUserInfo();
+ let customBlockedUsers = magicJS.read(blockedUsersKey, userInfo.id);
+ customBlockedUsers = !!customBlockedUsers ? customBlockedUsers : {};
+ let obj = JSON.parse(magicJS.response.body);
+ magicJS.logDebug(`当前黑名单列表: ${JSON.stringify(customBlockedUsers)}`);
+ delete obj["ad_info"];
+ delete obj["roundtable_info"];
+ let data = obj["data"].filter((element) => {
+ let blackUserName = "";
+ try{
+ if ("author" in element){
+ blackUserName = element["author"]["name"]
+ }
+ else if("target" in element){
+ blackUserName = element["target"]["author"]["name"]
+ }
+ }
+ catch (ex){
+ magicJS.logError(`获取回答列表用户名出现异常:${err}`);
+ }
+ return blackUserName == "" || !customBlockedUsers[blackUserName];
+ });
+ obj["data"] = data;
+ let body = JSON.stringify(obj);
+ magicJS.logDebug(`修改后的回答列表数据:${body}`);
+ response = { body: body };
+ } catch (err) {
+ magicJS.logError(`知乎回答列表去广告出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 关注列表去广告
+ *
+ * @param {*}
+ * @return {*}
+ */
+function removeMomentsAds() {
+ let response = null;
+ try {
+ let obj = JSON.parse(magicJS.response.body.replace(/(\w+"+\s?):\s?(\d{15,})/g, '$1:"$2"'));
+ const user_info = getUserInfo();
+ let customBlockedUsers = magicJS.read(blockedUsersKey, user_info.id);
+ customBlockedUsers = !!customBlockedUsers ? customBlockedUsers : {};
+ let data = [];
+
+ const settings_moments_stream = magicJS.read("zhihu_settings_moments_stream") == true;
+ const settings_blocked_users = magicJS.read("zhihu_settings_blocked_users") != false;
+
+ for (let i = 0; i < obj["data"].length; i++) {
+ // let element = targetIdFix(obj["data"][i]);
+ let element = obj["data"][i];
+ if (!element["ad"] && !element["adjson"] && !element["ad_list"]) {
+ // 判断转发的想法是否含有黑名单用户
+ if (settings_blocked_users && element.target && element.target.origin_pin && element.target.origin_pin.author && customBlockedUsers[element.target.origin_pin.author.name]) {
+ magicJS.notifyDebug(`屏蔽“${element.target.author.name}”转发黑名单用户“${element.target.origin_pin.author.name}”的想法。`);
+ }
+
+ // 屏蔽关注页的“最新视频”
+ else if (!settings_moments_stream || element["type"] != "videos") {
+ data.push(element);
+ }
+ }
+ }
+ obj["data"] = data;
+ response = { body: JSON.stringify(obj) };
+ } catch (err) {
+ magicJS.logError(`知乎关注列表去广告出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 推荐去广告与黑名单增强
+ *
+ * @param {*}
+ * @return {*}
+ */
+function removeRecommendAds() {
+ let response = null;
+ try {
+ const settings_remove_yanxuan = magicJS.read("zhihu_settings_remove_yanxuan") == true;
+ const settings_recommend_stream = magicJS.read("zhihu_settings_recommend_stream") == true;
+ const settings_remove_article = magicJS.read("zhihu_settings_remove_article") == true;
+ // 默认开启
+ const settings_blocked_keywords = magicJS.read("zhihu_settings_blocked_keywords") != false;
+ const settings_blocked_users = magicJS.read("zhihu_settings_blocked_users") != false;
+ const user_info = getUserInfo();
+
+ let keywords = magicJS.read(keywordBlockKey, user_info.id);
+ keywords = settings_blocked_keywords && !!keywords ? keywords : [];
+ let customBlockedUsers = magicJS.read(blockedUsersKey, user_info.id);
+ customBlockedUsers = settings_blocked_users && !!customBlockedUsers ? customBlockedUsers : {};
+
+ const dataFilter = (element) => {
+ let elementStr = JSON.stringify(element);
+ // 是否为广告
+ let isAd = element["card_type"] === "slot_event_card" || element["card_type"] === "slot_video_event_card" || element.hasOwnProperty("ad");
+ // 是否为流媒体
+ let isStream = isAd != true && elementStr.search(/"(type|style)+"\s?:\s?"(drama|zvideo|Video|BIG_IMAGE)+"/i) >= 0;
+ let removeStream = isStream && settings_recommend_stream;
+ // 是否为文章
+ let isArticle = elementStr.search(/"(type|style)+"\s?:\s?"article"/i) >= 0;
+ let removeArticle = isArticle && settings_remove_article;
+ // 是否匹配脚本关键词过滤
+ let matchKeyword = false;
+ if (isStream != true && settings_blocked_keywords) {
+ for (let i = 0; i < keywords.length; i++) {
+ if (elementStr.search(keywords[i]) >= 0) {
+ if (magicJS.isDebug) {
+ let elementTitle = element.common_card.feed_content.title.panel_text;
+ let elementContent = element.common_card.feed_content.content.panel_text;
+ let actionUrl = "";
+ try {
+ actionUrl = element.common_card.feed_content.title.action.intent_url;
+ } catch { }
+ magicJS.logDebug(`匹配关键字:\n${keywords[i]}\n标题:\n${elementTitle}\n内容:\n${elementContent}`);
+ magicJS.notifyDebug(scriptName, `关键字:${keywords[i]}`, `${elementTitle}\n${elementContent}`, actionUrl);
+ }
+ matchKeyword = true;
+ break;
+ }
+ }
+ }
+ // 是否为黑名单用户
+ let isBlockedUser = false;
+ try {
+ isBlockedUser =
+ matchKeyword != true && settings_blocked_users && customBlockedUsers && element["common_card"]["feed_content"]["source_line"]["elements"][1]["text"]["panel_text"] in customBlockedUsers;
+ } catch {
+ isBlockedUser = false;
+ }
+ return !(isAd || removeStream || matchKeyword || isBlockedUser || removeArticle);
+ };
+
+ // 修复number类型精度丢失
+ let obj = JSON.parse(magicJS.response.body.replace(/(\w+"+\s?):\s?(\d{15,})/g, '$1:"$2"'));
+ obj["data"] = obj["data"].filter(dataFilter);
+ response = { body: JSON.stringify(obj) };
+ } catch (err) {
+ magicJS.logError(`知乎推荐列表去广告出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 黑名单增强 - 浏览黑名单用户信息时自动加入脚本黑名单
+ *
+ * @param {*}
+ * @return {*}
+ */
+function autoInsertBlackList() {
+ let response = null;
+ try {
+ let obj = JSON.parse(magicJS.response.body);
+ // 删除MCN信息
+ delete obj["mcn_user_info"];
+ response = { body: JSON.stringify(obj) };
+ // 如已是黑名单用户,但不在脚本黑名单中,则自动加入
+ if (obj.name && obj.id && obj.is_blocking === true) {
+ const userInfo = getUserInfo();
+ let customBlockedUsers = magicJS.read(blockedUsersKey, userInfo.id);
+ customBlockedUsers = typeof customBlockedUsers === "object" && !!customBlockedUsers ? customBlockedUsers : {};
+ if (!customBlockedUsers[obj.name]) {
+ magicJS.logDebug(`当前需要加入黑名单的用户Id:${obj["id"]},用户名:${obj["name"]}`);
+ customBlockedUsers[obj["name"]] = obj["id"];
+ magicJS.write(blockedUsersKey, customBlockedUsers, userInfo.id);
+ magicJS.logDebug(`${obj["name"]}写入脚本黑名单成功,当前脚本黑名单数据:${JSON.stringify(customBlockedUsers)}`);
+ magicJS.notify(`已自动将用户“${obj["name"]}”写入脚本黑名单。`);
+ }
+ }
+ } catch (err) {
+ magicJS.logError(`知乎去除MCN信息出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 处理登录用户信息
+ *
+ * @param {*}
+ * @return {*}
+ */
+function processUserInfo() {
+ let response = null;
+ try {
+ let obj = JSON.parse(magicJS.response.body);
+ magicJS.logDebug(`用户登录用户信息,接口响应:${magicJS.response.body}`);
+ if (obj && obj["id"] && obj.hasOwnProperty("vip_info") && obj["vip_info"].hasOwnProperty("is_vip")) {
+ const userInfo = {
+ id: obj["id"],
+ is_vip: obj["vip_info"]["is_vip"] ? obj["vip_info"]["is_vip"] !== undefined : false,
+ };
+ magicJS.logDebug(`当前用户id:${obj["id"]},是否为VIP:${obj["vip_info"]["is_vip"]}`);
+ magicJS.write(currentUserInfoKey, userInfo);
+ // 在知乎APP显示VIP,仅自己可见,打开后才能使用屏蔽关键词解锁
+ if (magicJS.read("zhihu_settings_fake_vip") != false && obj["vip_info"]["is_vip"] === false) {
+ obj["vip_info"]["is_vip"] = true;
+ obj["vip_info"]["vip_icon"] = {
+ url: "https://pic1.zhimg.com/v2-4812630bc27d642f7cafcd6cdeca3d7a_r.png",
+ night_mode_url: "https://pic1.zhimg.com/v2-c9686ff064ea3579730756ac6c289978_r.png",
+ };
+ obj["vip_info"]["entrance"] = {
+ icon: {
+ url: "https://pic1.zhimg.com/v2-5b7012c8c22fd520f5677305e1e551bf.png",
+ night_mode_url: "https://pic1.zhimg.com/v2-e51e3252d7a2cb016a70879defd5da0b.png",
+ },
+ title: "我的盐选会员",
+ expires_day: "2033-12-24",
+ sub_title: null,
+ button_text: "你好,知乎!",
+ jump_url: "zhihu://vip/purchase",
+ button_jump_url: "zhihu://vip/purchase",
+ sub_title_new: null,
+ identity: "svip",
+ };
+ obj["vip_info"]["entrance_new"] = {
+ left_button: {
+ title: "精选会员内容",
+ description: "为您严选好内容",
+ jump_url: "zhihu://market/home",
+ },
+ right_button: {
+ title: "我的盐选会员",
+ description: "畅享 10w+ 优质内容",
+ jump_url: "zhihu://vip/my",
+ },
+ };
+ obj["vip_info"]["entrance_v2"] = {
+ title: "我的盐选会员",
+ sub_title: "畅享 10w+ 优质内容",
+ jump_url: "zhihu://vip/my",
+ button_text: "查看权益",
+ };
+ response = { body: JSON.stringify(obj) };
+ }
+ } else {
+ magicJS.logWarning(`没有获取到本次登录用户信息,如未对功能造成影响,请忽略此日志。`);
+ }
+ } catch (err) {
+ magicJS.logError(`知乎获取当前用户信息出现异常:${err}`);
+ }
+ return response;
+}
+
+/**
+ * 回答内容优化
+ *
+ * @param {*}
+ * @return {*}
+ */
+function modifyAnswer() {
+ let response = null;
+ try {
+ let html = magicJS.response.body;
+ // 付费内容提醒
+ if ((html.indexOf("查看完整内容") >= 0 || html.indexOf("查看全部章节") >= 0) && html.indexOf("paid") >= 0) {
+ let matchStr = html.match(/(richText[^<]*>)(.)/)[1];
+ let start = html.lastIndexOf(matchStr) + matchStr.length;
+ let insertText =
+ '';
+ response = { body: html.slice(0, start) + insertText + html.slice(start) };
+ }
+
+ // 营销推广提醒
+ else if (html.indexOf("ad-link-card") >= 0 || html.indexOf("xg.zhihu.com") >= 0 || html.indexOf("知乎营销平台") >= 0) {
+ let matchStr = html.match(/(richText[^<]*>)(.)/)[1];
+ let start = html.lastIndexOf(matchStr) + matchStr.length;
+ let insertText =
+ '';
+ response = { body: html.slice(0, start) + insertText + html.slice(start) };
+ }
+
+ // 购物推广提醒
+ else if (html.indexOf("mcn-link-card") >= 0) {
+ let matchStr = html.match(/(richText[^<]*>)(.)/)[1];
+ let start = html.lastIndexOf(matchStr) + matchStr.length;
+ let insertText =
+ '';
+ response = { body: html.slice(0, start) + insertText + html.slice(start) };
+ }
+
+ // 彩蛋
+ else if (Math.floor(Math.random() * 200) == 7) {
+ let matchStr = html.match(/(richText[^<]*>)(.)/)[1];
+ let start = html.lastIndexOf(matchStr) + matchStr.length;
+ let insertText =
+ '';
+ response = { body: html.slice(0, start) + insertText + html.slice(start) };
+ }
+ } catch (err) {
+ magicJS.logError(`知乎付费内容提醒出现异常:${err}`);
+ }
+ return response;
+}
+
+
+/**
+ * @description: 黑名单管理
+ * @param {*}
+ * @return {*}
+ */
+function manageBlackUser() {
+ const userInfo = getUserInfo();
+ let defaultBlockedUsers = {};
+ let customBlockedUsers = magicJS.read(blockedUsersKey, userInfo.id);
+ customBlockedUsers = typeof customBlockedUsers === "object" && !!customBlockedUsers ? customBlockedUsers : {};
+ defaultAnswerBlockedUsers.forEach((element) => {
+ customBlockedUsers[element] = "00000000000000000000000000000000";
+ defaultBlockedUsers[element] = "00000000000000000000000000000000";
+ });
+ magicJS.logDebug(`当前用户id:${userInfo.id},脚本黑名单:${JSON.stringify(customBlockedUsers)}`);
+ // 获取黑名单
+ if (magicJS.request.method == "GET") {
+ try {
+ // 加载黑名单首页时,清空历史黑名单,仅保留脚本默认黑名单
+ if (magicJS.request.url.indexOf("offset") < 0) {
+ customBlockedUsers = defaultBlockedUsers;
+ magicJS.logDebug("脚本黑名单已清空,请滑动至黑名单末尾保证重新获取完成。");
+ magicJS.notify("脚本黑名单已清空,请滑动至黑名单末尾保证重新获取完成。");
+ }
+ let obj = JSON.parse(magicJS.response.body);
+ if (!!obj["data"]) {
+ magicJS.logDebug(`本次滑动获取的黑名单信息:${JSON.stringify(obj["data"])}`);
+ obj["data"].forEach((element) => {
+ if (element["name"] != "[已重置]") {
+ customBlockedUsers[element["name"]] = element["id"];
+ }
+ });
+ magicJS.write(blockedUsersKey, customBlockedUsers, userInfo.id);
+ if (obj["paging"]["is_end"] == true) {
+ magicJS.notify(`获取脚本黑名单结束,当前黑名单共${Object.keys(customBlockedUsers).length - defaultAnswerBlockedUsers.length}人。\n脚本内置黑名单${defaultAnswerBlockedUsers.length}人。`);
+ magicJS.logDebug(`脚本黑名单内容:${JSON.stringify(customBlockedUsers)}。`);
+ }
+ } else {
+ magicJS.logWarning(`获取黑名单失败,接口响应不合法:${magicJS.response.body}`);
+ }
+ } catch (err) {
+ magicJS.del(blockedUsersKey);
+ magicJS.logError(`获取黑名单失败,异常信息:${err}`);
+ magicJS.notify("获取黑名单失败,执行异常,已清空黑名单。");
+ }
+ }
+ // 写入黑名单
+ else if (magicJS.request.method == "POST") {
+ try {
+ let obj = JSON.parse(magicJS.response.body);
+ if (obj.hasOwnProperty("name") && obj.hasOwnProperty("id")) {
+ magicJS.logDebug(`当前需要加入黑名单的用户Id:${obj["id"]},用户名:${obj["name"]}`);
+ if (obj["id"]) {
+ customBlockedUsers[obj["name"]] = obj["id"];
+ magicJS.write(blockedUsersKey, customBlockedUsers, userInfo.id);
+ magicJS.logDebug(`${obj["name"]}写入脚本黑名单成功,当前脚本黑名单数据:${JSON.stringify(customBlockedUsers)}`);
+ magicJS.notify(`已将用户“${obj["name"]}”写入脚本黑名单。`);
+ } else {
+ magicJS.logError(`${obj["name"]}写入脚本黑名单失败,没有获取到用户Id。`);
+ magicJS.notify(`将用户“${obj["name"]}”写入脚本黑名单失败!`);
+ }
+ } else {
+ magicJS.logWarning(`写入黑名单失败,接口响应不合法:${magicJS.response.body}`);
+ magicJS.notify("写入脚本黑名单失败,接口返回不合法。");
+ }
+ } catch (err) {
+ magicJS.logError(`写入黑名单失败,异常信息:${err}`);
+ magicJS.notify("写入脚本黑名单失败,执行异常,请查阅日志。");
+ }
+ }
+ // 移出黑名单
+ else if (magicJS.request.method == "DELETE") {
+ try {
+ let obj = JSON.parse(magicJS.response.body);
+ if (obj.success) {
+ let user_id = magicJS.request.url.match(/https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/settings\/blocked_users\/([0-9a-zA-Z]*)/)[1];
+ if (user_id) {
+ magicJS.logDebug(`当前需要移出黑名单的用户Id:${user_id}`);
+ for (let username in customBlockedUsers) {
+ if (customBlockedUsers[username] == user_id) {
+ delete customBlockedUsers[username];
+ magicJS.write(blockedUsersKey, customBlockedUsers, userInfo.id);
+ magicJS.logDebug(`${username}移出脚本黑名单成功,当前脚本黑名单数据:${JSON.stringify(customBlockedUsers)}`);
+ magicJS.notify(`已将用户“${username}”移出脚本黑名单!`);
+ break;
+ }
+ }
+ } else {
+ magicJS.logError("将用户移出脚本黑名单失败!\n建议从设置中刷新黑名单数据。");
+ magicJS.notify(`将用户移出脚本黑名单失败,没有获取到用户Id。\n建议从设置中刷新黑名单数据。`);
+ }
+ } else {
+ magicJS.logWarning(`移出黑名单失败,接口响应不合法:${magicJS.response.body}`);
+ magicJS.notify("移出脚本黑名单失败,接口返回不合法。");
+ }
+ } catch (err) {
+ magicJS.logError(`移出黑名单失败,异常信息:${err}`);
+ magicJS.notify("移出脚本黑名单失败,执行异常,请查阅日志。");
+ }
+ }
+}
+
+/**
+ * @description: 获取用户信息
+ * @param {*}
+ * @return {*}
+ */
+function getUserInfo() {
+ let defaultUserInfo = { id: "default", is_vip: false };
+ try {
+ const userInfo = magicJS.read(currentUserInfoKey);
+ if (typeof userInfo === "string") userInfo = JSON.parse(userInfo);
+ if (!!userInfo && userInfo.hasOwnProperty("id")) {
+ return userInfo;
+ } else {
+ return defaultUserInfo;
+ }
+ } catch (err) {
+ magicJS.logError(`获取用户信息出现异常:${err}`);
+ return defaultUserInfo;
+ }
+}
+
+
+/**
+ * @description: 知乎8.3.0移除推荐页顶部项
+ * @param {*}
+ * @return {*}
+ */
+function removeFeedSections() {
+ let response = null;
+ try {
+ let obj = JSON.parse(magicJS.response.body);
+ obj.guess_like_sections = [];
+ obj.selected_sections = [];
+ obj.more_sections = [];
+ response = { body: JSON.stringify(obj) };
+ } catch (err) {
+ magicJS.logError(`知乎移除推荐页顶部项出现异常:${err}`);
+ }
+ return response;
+}
+
+// prettier-ignore
+function MagicJS(scriptName = "MagicJS", logLevel = "INFO") { return new class { constructor() { if (this._startTime = Date.now(), this.version = "2.2.3.6", this.scriptName = scriptName, this.logLevels = { DEBUG: 5, INFO: 4, NOTIFY: 3, WARNING: 2, ERROR: 1, CRITICAL: 0, NONE: -1 }, this.isLoon = "undefined" != typeof $loon, this.isQuanX = "undefined" != typeof $task, this.isJSBox = "undefined" != typeof $drive, this.isNode = "undefined" != typeof module && !this.isJSBox, this.isSurge = "undefined" != typeof $httpClient && !this.isLoon, this.node = { request: void 0, fs: void 0, data: {} }, this.iOSUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Mobile/15E148 Safari/604.1", this.pcUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36 Edg/84.0.522.59", this._logLevel = "INFO", this.logLevel = logLevel, this._barkUrl = "", this._barkKey = "", this.isNode) { this.node.fs = require("fs"), this.node.request = require("request"); try { this.node.fs.accessSync("./magic.json", this.node.fs.constants.R_OK | this.node.fs.constants.W_OK) } catch (err) { this.node.fs.writeFileSync("./magic.json", "{}", { encoding: "utf8" }) } this.node.data = require("./magic.json") } else this.isJSBox && ($file.exists("drive://MagicJS") || $file.mkdir("drive://MagicJS"), $file.exists("drive://MagicJS/magic.json") || $file.write({ data: $data({ string: "{}" }), path: "drive://MagicJS/magic.json" })) } set barkUrl(url) { try { let _url = url.replace(/\/+$/g, ""); this._barkUrl = `${/^https?:\/\/([^/]*)/.exec(_url)[0]}/push`, this._barkKey = /\/([^\/]+)\/?$/.exec(_url)[1] } catch (err) { this.logDebug("Bark config error.") } } set logLevel(level) { let magic_loglevel = this.read("magicjs_loglevel"); this._logLevel = magic_loglevel || level.toUpperCase() } get logLevel() { return this._logLevel } get isRequest() { return "undefined" != typeof $request && "undefined" == typeof $response } get isResponse() { return "undefined" != typeof $response } get isDebug() { return "DEBUG" === this.logLevel } get request() { return "undefined" != typeof $request ? $request : void 0 } get response() { return "undefined" != typeof $response ? ($response.hasOwnProperty("status") && ($response.statusCode = $response.status), $response.hasOwnProperty("statusCode") && ($response.status = $response.statusCode), $response) : void 0 } get platform() { return this.isSurge ? "Surge" : this.isQuanX ? "Quantumult X" : this.isLoon ? "Loon" : this.isJSBox ? "JSBox" : this.isNode ? "Node.js" : "Unknown" } read(key, session = "") { let val = ""; this.isSurge || this.isLoon ? val = $persistentStore.read(key) : this.isQuanX ? val = $prefs.valueForKey(key) : this.isNode ? val = this.node.data : this.isJSBox && (val = $file.read("drive://MagicJS/magic.json").string); try { this.isNode && (val = val[key]), this.isJSBox && (val = JSON.parse(val)[key]), session && ("string" == typeof val && (val = JSON.parse(val)), val = val && "object" == typeof val ? val[session] : null) } catch (err) { this.logError(err), val = session ? {} : null, this.del(key) } void 0 === val && (val = null); try { val && "string" == typeof val && (val = JSON.parse(val)) } catch (err) { } return this.logDebug(`READ DATA [${key}]${session ? `[${session}]` : ""}(${typeof val})\n${JSON.stringify(val)}`), val } write(key, val, session = "") { let data = session ? {} : ""; if (session && (this.isSurge || this.isLoon) ? data = $persistentStore.read(key) : session && this.isQuanX ? data = $prefs.valueForKey(key) : this.isNode ? data = this.node.data : this.isJSBox && (data = JSON.parse($file.read("drive://MagicJS/magic.json").string)), session) { try { "string" == typeof data && (data = JSON.parse(data)), data = "object" == typeof data && data ? data : {} } catch (err) { this.logError(err), this.del(key), data = {} } this.isJSBox || this.isNode ? (data[key] && "object" == typeof data[key] || (data[key] = {}), data[key].hasOwnProperty(session) || (data[key][session] = null), void 0 === val ? delete data[key][session] : data[key][session] = val) : void 0 === val ? delete data[session] : data[session] = val } else this.isNode || this.isJSBox ? void 0 === val ? delete data[key] : data[key] = val : data = void 0 === val ? null : val; "object" == typeof data && (data = JSON.stringify(data)), this.isSurge || this.isLoon ? $persistentStore.write(data, key) : this.isQuanX ? $prefs.setValueForKey(data, key) : this.isNode ? this.node.fs.writeFileSync("./magic.json", data) : this.isJSBox && $file.write({ data: $data({ string: data }), path: "drive://MagicJS/magic.json" }), this.logDebug(`WRITE DATA [${key}]${session ? `[${session}]` : ""}(${typeof val})\n${JSON.stringify(val)}`) } del(key, session = "") { this.logDebug(`DELETE KEY [${key}]${session ? `[${session}]` : ""}`), this.write(key, null, session) } notify(title = this.scriptName, subTitle = "", body = "", opts = "") { let convertOptions; if (opts = (_opts => { let newOpts = {}; if ("string" == typeof _opts) this.isLoon ? newOpts = { openUrl: _opts } : this.isQuanX ? newOpts = { "open-url": _opts } : this.isSurge && (newOpts = { url: _opts }); else if ("object" == typeof _opts) if (this.isLoon) newOpts.openUrl = _opts["open-url"] ? _opts["open-url"] : "", newOpts.mediaUrl = _opts["media-url"] ? _opts["media-url"] : ""; else if (this.isQuanX) newOpts = _opts["open-url"] || _opts["media-url"] ? _opts : {}; else if (this.isSurge) { let openUrl = _opts["open-url"] || _opts.openUrl; newOpts = openUrl ? { url: openUrl } : {} } return newOpts })(opts), 1 == arguments.length && (title = this.scriptName, subTitle = "", body = arguments[0]), this.logNotify(`title:${title}\nsubTitle:${subTitle}\nbody:${body}\noptions:${"object" == typeof opts ? JSON.stringify(opts) : opts}`), this.isSurge) $notification.post(title, subTitle, body, opts); else if (this.isLoon) opts ? $notification.post(title, subTitle, body, opts) : $notification.post(title, subTitle, body); else if (this.isQuanX) $notify(title, subTitle, body, opts); else if (this.isJSBox) { let push = { title: title, body: subTitle ? `${subTitle}\n${body}` : body }; $push.schedule(push) } this._barkUrl && this._barkKey && this.notifyBark(title, subTitle, body) } notifyDebug(title = this.scriptName, subTitle = "", body = "", opts = "") { "DEBUG" === this.logLevel && (1 == arguments.length && (title = this.scriptName, subTitle = "", body = arguments[0]), this.notify(title, subTitle, body, opts)) } notifyBark(title = this.scriptName, subTitle = "", body = "", opts = "") { let options = { url: this._barkUrl, headers: { "Content-Type": "application/json; charset=utf-8" }, body: { title: title, body: subTitle ? `${subTitle}\n${body}` : body, device_key: this._barkKey } }; this.post(options, err => { }) } log(msg, level = "INFO") { this.logLevels[this._logLevel] < this.logLevels[level.toUpperCase()] || console.log(`[${level}] [${this.scriptName}]\n${msg}\n`) } logDebug(msg) { this.log(msg, "DEBUG") } logInfo(msg) { this.log(msg, "INFO") } logNotify(msg) { this.log(msg, "NOTIFY") } logWarning(msg) { this.log(msg, "WARNING") } logError(msg) { this.log(msg, "ERROR") } logRetry(msg) { this.log(msg, "RETRY") } adapterHttpOptions(options, method) { let _options = "object" == typeof options ? Object.assign({}, options) : { url: options, headers: {} }; _options.hasOwnProperty("header") && !_options.hasOwnProperty("headers") && (_options.headers = _options.header, delete _options.header), _options.headers && "object" == typeof _options.headers && _options.headers["User-Agent"] || (_options.headers && "object" == typeof _options.headers || (_options.headers = {}), this.isNode ? _options.headers["User-Agent"] = this.pcUserAgent : _options.headers["User-Agent"] = this.iOSUserAgent); let skipScripting = !1; if (("object" == typeof _options.opts && (!0 === _options.opts.hints || !0 === _options.opts["Skip-Scripting"]) || "object" == typeof _options.headers && !0 === _options.headers["X-Surge-Skip-Scripting"]) && (skipScripting = !0), skipScripting || (this.isSurge ? _options.headers["X-Surge-Skip-Scripting"] = !1 : this.isLoon ? _options.headers["X-Requested-With"] = "XMLHttpRequest" : this.isQuanX && ("object" != typeof _options.opts && (_options.opts = {}), _options.opts.hints = !1)), this.isSurge && !skipScripting || delete _options.headers["X-Surge-Skip-Scripting"], !this.isQuanX && _options.hasOwnProperty("opts") && delete _options.opts, this.isQuanX && _options.hasOwnProperty("opts") && delete _options.opts["Skip-Scripting"], "GET" === method && !this.isNode && _options.body) { let qs = Object.keys(_options.body).map(key => void 0 === _options.body ? "" : `${encodeURIComponent(key)}=${encodeURIComponent(_options.body[key])}`).join("&"); _options.url.indexOf("?") < 0 && (_options.url += "?"), _options.url.lastIndexOf("&") + 1 != _options.url.length && _options.url.lastIndexOf("?") + 1 != _options.url.length && (_options.url += "&"), _options.url += qs, delete _options.body } return this.isQuanX ? (_options.hasOwnProperty("body") && "string" != typeof _options.body && (_options.body = JSON.stringify(_options.body)), _options.method = method) : this.isNode ? (delete _options.headers["Accept-Encoding"], "object" == typeof _options.body && ("GET" === method ? (_options.qs = _options.body, delete _options.body) : "POST" === method && (_options.json = !0, _options.body = _options.body))) : this.isJSBox && (_options.header = _options.headers, delete _options.headers), _options } adapterHttpResponse(resp) { let _resp = { body: resp.body, headers: resp.headers, json: () => JSON.parse(_resp.body) }; return resp.hasOwnProperty("statusCode") && resp.statusCode && (_resp.status = resp.statusCode), _resp } get(options, callback) { let _options = this.adapterHttpOptions(options, "GET"); this.logDebug(`HTTP GET: ${JSON.stringify(_options)}`), this.isSurge || this.isLoon ? $httpClient.get(_options, callback) : this.isQuanX ? $task.fetch(_options).then(resp => { resp.status = resp.statusCode, callback(null, resp, resp.body) }, reason => callback(reason.error, null, null)) : this.isNode ? this.node.request.get(_options, (err, resp, data) => { resp = this.adapterHttpResponse(resp), callback(err, resp, data) }) : this.isJSBox && (_options.handler = resp => { let err = resp.error ? JSON.stringify(resp.error) : void 0, data = "object" == typeof resp.data ? JSON.stringify(resp.data) : resp.data; callback(err, resp.response, data) }, $http.get(_options)) } getPromise(options) { return new Promise((resolve, reject) => { magicJS.get(options, (err, resp) => { err ? reject(err) : resolve(resp) }) }) } post(options, callback) { let _options = this.adapterHttpOptions(options, "POST"); if (this.logDebug(`HTTP POST: ${JSON.stringify(_options)}`), this.isSurge || this.isLoon) $httpClient.post(_options, callback); else if (this.isQuanX) $task.fetch(_options).then(resp => { resp.status = resp.statusCode, callback(null, resp, resp.body) }, reason => { callback(reason.error, null, null) }); else if (this.isNode) { let resp = this.node.request.post(_options, callback); resp.status = resp.statusCode, delete resp.statusCode } else this.isJSBox && (_options.handler = resp => { let err = resp.error ? JSON.stringify(resp.error) : void 0, data = "object" == typeof resp.data ? JSON.stringify(resp.data) : resp.data; callback(err, resp.response, data) }, $http.post(_options, {})) } done(value = {}) { this._endTime = Date.now(); let span = (this._endTime - this._startTime) / 1e3; magicJS.logDebug(`SCRIPT COMPLETED: ${span}S.`), "undefined" != typeof $done && $done(value) } isToday(day) { if (null == day) return !1; { let today = new Date; return "string" == typeof day && (day = new Date(day)), today.getFullYear() == day.getFullYear() && today.getMonth() == day.getMonth() && today.getDay() == day.getDay() } } isNumber(val) { return "NaN" !== parseFloat(val).toString() } attempt(promise, defaultValue = null) { return promise.then(args => [null, args]).catch(ex => (this.logError(ex), [ex, defaultValue])) } retry(fn, retries = 5, interval = 0, callback = null) { return (...args) => new Promise((resolve, reject) => { function _retry(...args) { Promise.resolve().then(() => fn.apply(this, args)).then(result => { "function" == typeof callback ? Promise.resolve().then(() => callback(result)).then(() => { resolve(result) }).catch(ex => { retries >= 1 ? interval > 0 ? setTimeout(() => _retry.apply(this, args), interval) : _retry.apply(this, args) : reject(ex), retries-- }) : resolve(result) }).catch(ex => { this.logRetry(ex), retries >= 1 && interval > 0 ? setTimeout(() => _retry.apply(this, args), interval) : retries >= 1 ? _retry.apply(this, args) : reject(ex), retries-- }) } _retry.apply(this, args) }) } formatTime(time, fmt = "yyyy-MM-dd hh:mm:ss") { var o = { "M+": time.getMonth() + 1, "d+": time.getDate(), "h+": time.getHours(), "m+": time.getMinutes(), "s+": time.getSeconds(), "q+": Math.floor((time.getMonth() + 3) / 3), S: time.getMilliseconds() }; /(y+)/.test(fmt) && (fmt = fmt.replace(RegExp.$1, (time.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let k in o) new RegExp("(" + k + ")").test(fmt) && (fmt = fmt.replace(RegExp.$1, 1 == RegExp.$1.length ? o[k] : ("00" + o[k]).substr(("" + o[k]).length))); return fmt } now() { return this.formatTime(new Date, "yyyy-MM-dd hh:mm:ss") } today() { return this.formatTime(new Date, "yyyy-MM-dd") } sleep(time) { return new Promise(resolve => setTimeout(resolve, time)) } }(scriptName) }
diff --git a/script/zhihu/zhihu_lite.lnplugin b/script/zhihu/zhihu_lite.lnplugin
index 0e4ac4ff1..3c6cbc2b7 100644
--- a/script/zhihu/zhihu_lite.lnplugin
+++ b/script/zhihu/zhihu_lite.lnplugin
@@ -14,8 +14,6 @@ DOMAIN,appcloud2.in.zhihu.com,REJECT
DOMAIN,mqtt.zhihu.com,REJECT
DOMAIN,sugar.zhihu.com,REJECT
USER-AGENT,AVOS*,REJECT
-# 拦截知乎开屏广告
-URL-REGEX,^https?:\/\/api\.zhihu\.com\/commercial_api\/launch_v2\?,REJECT
# 拦截知乎回答下的广告
URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v4\/answers\/\d+\/recommendations,REJECT
# 拦截知乎品牌提问广告
@@ -24,7 +22,7 @@ URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v\d+\/brand\/question/\d+/card\?,REJ
[URL Rewrite]
# 知乎拦截其他广告
-^https?:\/\/api\.zhihu\.com\/(notifications\/v3\/count|v3\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad) - reject-dict
+^https?:\/\/api\.zhihu\.com\/(notifications\/v\d\/count|v\d\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad|ad-style-service) - reject-dict
# 知乎网页版去广告
^https?:\/\/www\.zhihu\.com\/api\/v4/(questions|anwsers)\/\d+/related-readings - reject-dict
^https?:\/\/www\.zhihu\.com\/api\/v4\/hot_recommendation - reject-dict
@@ -35,14 +33,13 @@ URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v\d+\/brand\/question/\d+/card\?,REJ
^https?:\/\/www\.zhihu\.com\/api\/v\d+\/brand\/question/\d+/card\? - reject-dict
[Script]
-http-response ^https?:\/\/api\.zhihu\.com\/people requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_处理用户信息
-http-response ^https?:\/\/api\.zhihu\.com\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=) requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_信息流去广告
-http-response ^https?:\/\/api\.zhihu\.com\/v4\/questions requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_回答列表去广告
-http-response ^https?:\/\/api\.zhihu\.com\/search\/preset_words\? requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_预置关键词去广告
-http-response ^https?:\/\/api\.zhihu\.com\/search\/top_search\/tabs\/hot\/items requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_热搜去广告
-http-response ^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists?(\?|\/) requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_热榜去广告
-http-response ^https?:\/\/api\.zhihu\.com\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments? requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_评论去广告
-http-response ^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_优化软件配置
+http-response ^https?:\/\/api\.zhihu\.com\/people requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_处理用户信息
+http-response ^https?:\/\/api\.zhihu\.com\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=) requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_信息流去广告
+http-response ^https?:\/\/api\.zhihu\.com\/(v4\/)?questions\/\d+ requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_回答列表去广告
+http-response ^https?:\/\/api\.zhihu\.com\/search\/preset_words\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_预置关键词去广告
+http-response ^https?:\/\/api\.zhihu\.com\/search\/top_search\/tabs\/hot\/items requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_热搜去广告
+http-response ^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists?(\?|\/) requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_热榜去广告
+http-response ^https?:\/\/api\.zhihu\.com\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_评论去广告
[MITM]
hostname = www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,103.41.167.236,103.41.167.234,103.41.167.235,103.41.167.226
\ No newline at end of file
diff --git a/script/zhihu/zhihu_lite.qxrewrite b/script/zhihu/zhihu_lite.qxrewrite
index abca566c3..c52b4325f 100644
--- a/script/zhihu/zhihu_lite.qxrewrite
+++ b/script/zhihu/zhihu_lite.qxrewrite
@@ -1,25 +1,25 @@
# 知乎处理用户信息
-^https?:\/\/api\.zhihu\.com\/people\/ url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/people\/ url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎信息流去广告
-^https?:\/\/api\.zhihu\.com\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=)(?!\/people) url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=)(?!\/people) url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎回答列表去广告
-^https?:\/\/api\.zhihu\.com\/v4\/questions url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/(v4\/)?questions\/\d+ url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎预置关键词去广告
-^https?:\/\/api\.zhihu\.com\/search\/preset_words\? url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/search\/preset_words\? url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎热搜去广告
-^https?:\/\/api\.zhihu\.com\/search\/top_search\/tabs\/hot\/items url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/search\/top_search\/tabs\/hot\/items url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎热榜去广告
-^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists?(\?|\/) url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists?(\?|\/) url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎评论去广告
-^https?:\/\/api\.zhihu\.com\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments? url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments? url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 优化软件配置
-^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 拦截知乎开屏广告
URL-REGEX,^https?:\/\/api\.zhihu\.com\/commercial_api\/launch_v2\? url reject-dict
# 知乎去除回答下的广告
^https?:\/\/www\.zhihu\.com\/api\/v4\/answers\/\d+\/recommendations url reject-dict
# 知乎其他广告拦截
-^https?:\/\/api\.zhihu\.com\/(notifications\/v3\/count|v3\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad) url reject-dict
+^https?:\/\/api\.zhihu\.com\/(notifications\/v\d\/count|v\d\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad|ad-style-service) url reject-dict
# 知乎网页版去广告
^https?:\/\/www\.zhihu\.com\/api\/v4/(questions|anwsers)\/\d+/related-readings url reject-dict
^https?:\/\/www\.zhihu\.com\/api\/v4\/hot_recommendation url reject-dict
@@ -29,4 +29,4 @@ URL-REGEX,^https?:\/\/api\.zhihu\.com\/commercial_api\/launch_v2\? url reject-di
^https?:\/\/api\.zhihu\.com\/brand\/question\/\d+/card\? url reject-dict
^https?:\/\/www\.zhihu\.com\/api\/v\d+\/brand\/question/\d+/card\? url reject-dict
-hostname = www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,103.41.167.236,103.41.167.234,103.41.167.235,103.41.167.226
\ No newline at end of file
+hostname = www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,appcloud2.zhihu.com,103.41.167.236,103.41.167.234,103.41.167.235,103.41.167.226
\ No newline at end of file
diff --git a/script/zhihu/zhihu_lite.sgmodule b/script/zhihu/zhihu_lite.sgmodule
index e47bf6314..81e5a424b 100644
--- a/script/zhihu/zhihu_lite.sgmodule
+++ b/script/zhihu/zhihu_lite.sgmodule
@@ -3,21 +3,21 @@
[Rule]
# 知乎广告拦截
-RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_remove_ads.list,REJECT-NO-DROP
+RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_remove_ads.list,REJECT-NO-DROP
[Map Local]
# 知乎其他广告拦截
-^https?:\/\/api\.zhihu\.com\/(notifications\/v\d\/count|v\d\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad) data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
+^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/(notifications\/v\d\/count|v\d\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad|ad-style-service) data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
[Script]
-知乎_处理用户信息 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/people\/,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_信息流去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=)(?!\/people),script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_回答列表去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/v4\/questions,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_预置关键词去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/search\/preset_words\?,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_热搜去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/search\/top_search\/tabs\/hot\/items,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_热榜去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists?(\?|\/),script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_评论去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments?,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_优化软件配置 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+知乎_处理用户信息 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/people\/,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_信息流去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=)(?!\/people),script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_回答列表去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/(v4\/)?questions\/\d+,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_预置关键词去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/search\/preset_words\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_热搜去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/search\/top_search\/tabs\/hot\/items,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_热榜去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/topstory\/hot-lists?(\?|\/),script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_评论去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_优化软件配置 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
[MITM]
hostname = %APPEND% www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com
\ No newline at end of file
diff --git a/script/zhihu/zhihu_plus.lnplugin b/script/zhihu/zhihu_plus.lnplugin
index 6d104b362..c71d1951c 100644
--- a/script/zhihu/zhihu_plus.lnplugin
+++ b/script/zhihu/zhihu_plus.lnplugin
@@ -5,6 +5,7 @@
#!homepage= https://github.com/blackmatrix7/ios_rule_script
#!icon= https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.png
+[Rule]
# 知乎去广告
DOMAIN,118.89.204.198,REJECT
IP-CIDR,118.89.204.198/32,REJECT,no-resolve
@@ -13,10 +14,10 @@ DOMAIN,appcloud2.in.zhihu.com,REJECT
DOMAIN,mqtt.zhihu.com,REJECT
DOMAIN,sugar.zhihu.com,REJECT
USER-AGENT,AVOS*,REJECT
-# 拦截知乎开屏广告
-URL-REGEX,^https?:\/\/api\.zhihu\.com\/commercial_api\/launch_v2\?,REJECT
# 拦截知乎回答下的广告
URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v4\/answers\/\d+\/recommendations,REJECT
+# 知乎拦截部分预加载
+URL-REGEX,^https?:\/\/www\.zhihu\.com\/appview\/(p|v2\/answer|zvideo)\/.*entry=(preload-topstory|preload-search|preload-subscription),REJECT
# 拦截知乎品牌提问广告
URL-REGEX,^https?:\/\/api\.zhihu\.com\/brand\/question\/\d+/card\?,REJECT
URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v\d+\/brand\/question/\d+/card\?,REJECT
@@ -29,7 +30,7 @@ URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v\d+\/brand\/question/\d+/card\?,REJ
# 知乎拦截部分预加载
^https?:\/\/www\.zhihu\.com\/appview\/(p|v2\/answer|zvideo)\/.*entry=(preload-topstory|preload-search|preload-subscription) - reject
# 知乎拦截其他广告
-^https?:\/\/api\.zhihu\.com\/(notifications\/v3\/count|v3\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad) - reject-dict
+^https?:\/\/api\.zhihu\.com\/(notifications\/v\d\/count|v\d\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad|ad-style-service) - reject-dict
# 知乎网页版去广告
^https?:\/\/www\.zhihu\.com\/api\/v4/(questions|anwsers)\/\d+/related-readings - reject-dict
^https?:\/\/www\.zhihu\.com\/api\/v4\/hot_recommendation - reject-dict
@@ -46,20 +47,23 @@ URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v\d+\/brand\/question/\d+/card\?,REJ
^https?:\/\/api\.zhihu\.com\/people\/self\/new_user_card - reject-200
# 知乎去除Tab页关注人头像
^https?:\/\/api\.zhihu\.com\/moments\/tab_v2 - reject-dict
+# 屏蔽知乎8.3.0版本首页顶部的视频角标
+^https?:\/\/api\.zhihu\.com\/explore\/entry\/tips - reject
[Script]
-http-request ^https?:\/\/api\.zhihu\.com\/feed-root\/block requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_屏蔽关键字解锁
-http-response ^https?:\/\/api\.zhihu\.com\/people requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_处理用户信息
-http-response ^https?:\/\/api\.zhihu\.com\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=)(?!\/people) requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_信息流去广告及黑名单增强
-http-response ^https?:\/\/api\.zhihu\.com\/settings\/blocked_users requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_获取黑名单
-http-response ^https?:\/\/api\.zhihu\.com\/v4\/questions requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_回答列表去广告
-http-response ^https?:\/\/api\.zhihu\.com\/notifications\/v3\/(message|timeline\/entry\/system_message) requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_官方消息去广告
-http-response ^https?:\/\/api\.zhihu\.com\/search\/preset_words\? requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_预置关键词去广告
-http-response ^https?:\/\/www\.zhihu\.com\/appview\/v2\/answer\/.*(entry=(?!(preload-topstory|preload-search|preload-subscription)))? requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_回答内容优化
-http-response ^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_优化软件配置
-http-response ^https?:\/\/api\.zhihu\.com\/search\/top_search\/tabs\/hot\/items requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_热搜去广告
-http-response ^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists?(\?|\/) requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_热榜去广告
-http-response ^https?:\/\/api\.zhihu\.com\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments? requires-body=1,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js,tag=知乎_评论去广告
+http-request ^https?:\/\/api\.zhihu\.com\/feed-root\/block requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_屏蔽关键字解锁
+http-response ^https?:\/\/api\.zhihu\.com\/people requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_处理用户信息
+http-response ^https?:\/\/api\.zhihu\.com\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=)(?!\/people) requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_信息流去广告及黑名单增强
+http-response ^https?:\/\/api\.zhihu\.com\/settings\/blocked_users requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_获取黑名单
+http-response ^https?:\/\/api\.zhihu\.com\/(v4\/)?questions\/\d+ requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_回答列表去广告
+http-response ^https?:\/\/api\.zhihu\.com\/notifications\/v3\/(message|timeline\/entry\/system_message) requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_官方消息去广告
+http-response ^https?:\/\/api\.zhihu\.com\/search\/preset_words\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_预置关键词去广告
+http-response ^https?:\/\/www\.zhihu\.com\/appview\/v2\/answer\/.*(entry=(?!(preload-topstory|preload-search|preload-subscription)))? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_回答内容优化
+http-response ^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_优化软件配置
+http-response ^https?:\/\/api\.zhihu\.com\/search\/top_search\/tabs\/hot\/items requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_热搜去广告
+http-response ^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists?(\?|\/) requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_热榜去广告
+http-response ^https?:\/\/api\.zhihu\.com\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_评论去广告
+http-response ^https?:\/\/api\.zhihu\.com\/feed-root\/sections\/query\/v2 requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js,tag=知乎_移除推荐页顶部项
[MITM]
hostname = www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,appcloud2.zhihu.com,103.41.167.236,103.41.167.234,103.41.167.235,103.41.167.226
diff --git a/script/zhihu/zhihu_plus.qxrewrite b/script/zhihu/zhihu_plus.qxrewrite
index aa3cd7125..f5bbf54bc 100644
--- a/script/zhihu/zhihu_plus.qxrewrite
+++ b/script/zhihu/zhihu_plus.qxrewrite
@@ -1,27 +1,29 @@
# 知乎处理用户信息
-^https?:\/\/api\.zhihu\.com\/people\/ url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/people\/ url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎信息流去广告
-^https?:\/\/api\.zhihu\.com\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=)(?!\/people) url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=)(?!\/people) url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎回答列表去广告
-^https?:\/\/api\.zhihu\.com\/v4\/questions url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/(v4\/)?questions\/\d+ url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎获取黑名单
-^https?:\/\/api\.zhihu\.com\/settings\/blocked_users url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/settings\/blocked_users url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎官方消息去广告
-^https?:\/\/api\.zhihu\.com\/notifications\/v3\/(message|timeline\/entry\/system_message) url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/notifications\/v3\/(message|timeline\/entry\/system_message) url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎预置关键词去广告
-^https?:\/\/api\.zhihu\.com\/search\/preset_words\? url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/search\/preset_words\? url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 优化软件配置
-^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎热搜去广告
-^https?:\/\/api\.zhihu\.com\/search\/top_search\/tabs\/hot\/items url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/search\/top_search\/tabs\/hot\/items url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎热榜去广告
-^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists?(\?|\/) url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists?(\?|\/) url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎评论去广告
-^https?:\/\/api\.zhihu\.com\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments? url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments? url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎回答列表去广告
-^https?:\/\/www\.zhihu\.com\/appview\/v2\/answer\/.*(entry=(?!(preload-topstory|preload-search|preload-subscription)))? url script-response-body https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/www\.zhihu\.com\/appview\/v2\/answer\/.*(entry=(?!(preload-topstory|preload-search|preload-subscription)))? url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 知乎屏蔽关键词解锁
-^https?:\/\/api\.zhihu\.com\/feed-root\/block url script-analyze-echo-response https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+^https?:\/\/api\.zhihu\.com\/feed-root\/block url script-analyze-echo-response https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+# 知乎8.3.0移除推荐页顶部项
+^https?:\/\/api\.zhihu\.com\/feed-root\/sections\/query\/v2 url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
# 拦截知乎开屏广告
URL-REGEX,^https?:\/\/api\.zhihu\.com\/commercial_api\/launch_v2\? url reject-dict
# 知乎去除最常访问
@@ -29,7 +31,9 @@ URL-REGEX,^https?:\/\/api\.zhihu\.com\/commercial_api\/launch_v2\? url reject-di
# 知乎去除回答下的广告
^https?:\/\/www\.zhihu\.com\/api\/v4\/answers\/\d+\/recommendations url reject-dict
# 知乎其他广告拦截
-^https?:\/\/api\.zhihu\.com\/(notifications\/v3\/count|v3\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad) url reject-dict
+^https?:\/\/api\.zhihu\.com\/(notifications\/v\d\/count|v\d\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad|ad-style-service) url reject-dict
+# 知乎拦截部分预加载
+# ^https?:\/\/www\.zhihu\.com\/appview\/(p|v2\/answer|zvideo)\/.*entry=(preload-topstory|preload-search|preload-subscription) url reject-dict
# 知乎网页版去广告
^https?:\/\/www\.zhihu\.com\/api\/v4/(questions|anwsers)\/\d+/related-readings url reject-dict
^https?:\/\/www\.zhihu\.com\/api\/v4\/hot_recommendation url reject-dict
@@ -46,5 +50,7 @@ URL-REGEX,^https?:\/\/api\.zhihu\.com\/commercial_api\/launch_v2\? url reject-di
^https?:\/\/api\.zhihu\.com\/people\/self\/new_user_card url reject-200
# 知乎去除Tab页关注人头像
^https?:\/\/api\.zhihu\.com\/moments\/tab_v2 url reject-dict
+# 屏蔽知乎8.3.0版本首页顶部的视频角标
+^https?:\/\/api\.zhihu\.com\/explore\/entry\/tips url reject
hostname = www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,appcloud2.zhihu.com,103.41.167.236,103.41.167.234,103.41.167.235,103.41.167.226
\ No newline at end of file
diff --git a/script/zhihu/zhihu_plus.sgmodule b/script/zhihu/zhihu_plus.sgmodule
index 5e67ae5cc..677b7f4da 100644
--- a/script/zhihu/zhihu_plus.sgmodule
+++ b/script/zhihu/zhihu_plus.sgmodule
@@ -1,39 +1,47 @@
-#!name=知乎
+#!name=知乎助手Plus
#!desc=知乎助手Plus版,去广告及阅读体验增强
[Rule]
+# 屏蔽知乎8.3.0版本首页顶部的视频角标
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/explore\/entry\/tips,REJECT-TINYGIF
# 知乎广告拦截
-RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_remove_ads.list,REJECT-NO-DROP
+RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_remove_ads.list,REJECT-NO-DROP
+
[URL Rewrite]
-# 屏蔽知乎下发的配置,如皮肤等
-^https?:\/\/api\.zhihu\.com\/ab\/api\/v1\/products\/zhihu\/platforms\/ios\/config - reject
# 屏蔽知乎“我的”页面推荐开通会员的卡片
-^https?:\/\/api\.zhihu\.com\/people\/self\/new_user_card - reject
+^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/people\/self\/new_user_card - reject
[Map Local]
+# 屏蔽知乎下发的配置,如皮肤等
+^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/ab\/api\/v1\/products\/zhihu\/platforms\/ios\/config data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank" header="Content-Type: application/x-protobuf"
# 知乎去除Tab页关注人头像
-^https?:\/\/api\.zhihu\.com\/moments\/tab_v2 data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
+^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/moments\/tab_v2 data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
# 知乎去除最常访问
-^https?:\/\/api\.zhihu\.com\/moments\/recent data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
+^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/moments\/recent data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
# 知乎其他广告拦截
-^https?:\/\/api\.zhihu\.com\/(notifications\/v\d\/count|v\d\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad) data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
+^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/(notifications\/v\d\/count|v\d\/package|me\/guides|drama\/living-info|ad|fringe|commercial|market\/popovers|.*featured-comment-ad|ad-style-service) data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
# 屏蔽消息页面上拉的用户精选
-^https?:\/\/api\.zhihu\.com/moments/hybrid\? data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
+^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/moments/hybrid\? data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
+# 新人必看之类的入口
+^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/flow\/show_entrance data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
+# 疑似通知角标
+^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/settings\/new\/notification data="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/blank/blank_dict.json"
[Script]
-知乎_处理用户信息 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/people\/,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_信息流去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=)(?!\/people),script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_获取黑名单 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/settings\/blocked_users,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_官方消息去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/notifications\/v3\/(message|timeline\/entry\/system_message),script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_预置关键词去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/search\/preset_words\?,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_回答列表去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/v4\/questions,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_回答内容优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/www\.zhihu\.com\/appview\/v2\/answer\/.*(entry=(?!(preload-topstory|preload-search|preload-subscription)))?,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_优化软件配置 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_热搜去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/search\/top_search\/tabs\/hot\/items,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_热榜去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists?(\?|\/),script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_评论去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments?,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
-知乎_解锁关键词屏蔽 = type=http-request,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/feed-root\/block,script-path=https://gist.githubusercontent.com/blackmatrix7/2e550ebf28ca60d620654e394ec47e0b/raw/zhihu.js
+知乎_处理用户信息 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/people\/,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_信息流去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/(moments|topstory)(\/|\?)?(recommend|action=|feed_type=)(?!\/people),script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_获取黑名单 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/settings\/blocked_users,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_官方消息去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/notifications\/v3\/(message|timeline\/entry\/system_message),script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_预置关键词去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/search\/preset_words\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_回答列表去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/(v4\/)?questions\/\d+,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_回答内容优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/appview\/v2\/answer\/.*(entry=(?!(preload-topstory|preload-search|preload-subscription)))?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_优化软件配置 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_热搜去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/search\/top_search\/tabs\/hot\/items,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_热榜去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/topstory\/hot-lists?(\?|\/),script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_评论去广告 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/(comment_v5\/)?(answers|comments?|articles|pins)\/\d+\/(root_|child_)?comments?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_解锁关键词屏蔽 = type=http-request,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/feed-root\/block,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
+知乎_移除推荐页顶部项 = type=http-request,requires-body=1,max-size=0,pattern=^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/feed-root\/sections\/query\/v2,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu.js
[MITM]
-hostname = %APPEND% www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,appcloud2.zhihu.com
\ No newline at end of file
+hostname = %APPEND% www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,appcloud2.zhihu.com,103.41.167.236,103.41.167.234,103.41.167.235,103.41.167.226
\ No newline at end of file
diff --git a/script/zhihu/zhihu_remove_ads.list b/script/zhihu/zhihu_remove_ads.list
index 573bcfb6c..34898028e 100644
--- a/script/zhihu/zhihu_remove_ads.list
+++ b/script/zhihu/zhihu_remove_ads.list
@@ -5,15 +5,19 @@ DOMAIN,appcloud2.in.zhihu.com,REJECT
DOMAIN,mqtt.zhihu.com,REJECT
DOMAIN,sugar.zhihu.com,REJECT
USER-AGENT,AVOS*,REJECT
+# 屏蔽知乎8.3.0版本首页顶部的视频角标
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/explore\/entry\/tips,REJECT-TINYGIF
# 拦截知乎开屏广告
-URL-REGEX,^https?:\/\/api\.zhihu\.com\/commercial_api\/launch_v2\?,REJECT
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/commercial_api\/launch_v2\?,REJECT
# 拦截知乎品牌提问广告
-URL-REGEX,^https?:\/\/api\.zhihu\.com\/brand\/question\/\d+/card\?,REJECT
-URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v\d+\/brand\/question/\d+/card\?,REJECT
+URL-REGEX,^https?:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/brand\/question\/\d+/card\?,REJECT
+URL-REGEX,^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/api\/v\d+\/brand\/question/\d+/card\?,REJECT
# 拦截知乎回答下的广告
-URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v4\/answers\/\d+\/recommendations,REJECT
+URL-REGEX,^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/api\/v4\/answers\/\d+\/recommendations,REJECT
+# 知乎拦截部分预加载
+# URL-REGEX,^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/appview\/(p|v2\/answer|zvideo)\/.*entry=(preload-topstory|preload-search|preload-subscription),REJECT
# 知乎网页版去广告
-URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v4/(questions|anwsers)\/\d+/related-readings,REJECT-TINYGIF
-URL-REGEX,^https?:\/\/www\.zhihu\.com\/api\/v4\/hot_recommendation,REJECT-TINYGIF
-URL-REGEX,^https?:\/\/www\.zhihu\.com\/commercial_api\/banners_v3\/mobile_banner,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/api\/v4/(questions|anwsers)\/\d+/related-readings,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/api\/v4\/hot_recommendation,REJECT-TINYGIF
+URL-REGEX,^https?:\/\/(www\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/commercial_api\/banners_v3\/mobile_banner,REJECT-TINYGIF
URL-REGEX,^https?:\/\/zhuanlan\.zhihu\.com\/api\/articles\/\d+\/recommendation,REJECT-TINYGIF
\ No newline at end of file