[知乎助手] 适配知乎 8.25.1(10218) 版本

This commit is contained in:
blackmatrix7 2022-07-18 22:57:38 +08:00
parent d229629589
commit 1f923ba512
4 changed files with 34 additions and 29 deletions

View File

@ -139,7 +139,7 @@ Lite版本请确保所有Plus版本的选项都为关闭状态以减少不必
使用模块
```ini
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_plus.sgmodule
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_plus.sgmodule
```
### Loon
@ -148,7 +148,7 @@ https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhih
```ini
[Plugin]
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_plus.lnplugin, tag=知乎助手_去广告及体验增强, enabled=true
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_plus.lnplugin, tag=知乎助手_去广告及体验增强, enabled=true
```
### Quantumult X
@ -167,7 +167,7 @@ HOST,sugar.zhihu.com,reject
USER-AGENT,AVOS*,REJECT
[rewrite_remote]
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_plus.qxrewrite, tag=知乎助手_去广告及体验增强, update-interval=86400, opt-parser=false, enabled=true
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/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/zhihu/zhihu_lite.sgmodule
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_lite.sgmodule
```
### Loon
```ini
[Plugin]
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_lite.lnplugin, tag=知乎助手_去广告, enabled=true
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/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/zhihu/zhihu_lite.qxrewrite, tag=知乎助手_去广告, update-interval=86400, opt-parser=false, enabled=true
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_lite.qxrewrite, tag=知乎助手_去广告, update-interval=86400, opt-parser=false, enabled=true
```
## 其他问题

View File

@ -21,7 +21,7 @@ let magicJS = MagicJS(scriptName, "INFO");
response = modifyAnswer();
break;
// 处理登录用户信息
case /^https:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/people\/self/.test(magicJS.request.url):
case /^https:\/\/(api\.zhihu\.com|(103\.41\.167\.(226|234|235|236)))\/people\/self$/.test(magicJS.request.url):
response = processUserInfo();
break;
// 黑名单增强 - 浏览黑名单用户信息时自动加入脚本黑名单
@ -389,14 +389,16 @@ function removeHotListAds() {
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;
if ('data' in obj){
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}`);
magicJS.logError(`去除知乎热广告出现异常:${err}`);
}
return response;
}
@ -572,22 +574,25 @@ function removeQuestionsAds() {
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"]
// 去除回答列表中的黑名单用户
if ('data' in obj){
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"]
}
}
else if("target" in element){
blackUserName = element["target"]["author"]["name"]
catch (ex){
magicJS.logError(`获取回答列表用户名出现异常:${err}`);
}
}
catch (ex){
magicJS.logError(`获取回答列表用户名出现异常:${err}`);
}
return blackUserName == "" || !customBlockedUsers[blackUserName];
});
obj["data"] = data;
return blackUserName == "" || !customBlockedUsers[blackUserName];
});
obj["data"] = data;
}
let body = JSON.stringify(obj);
magicJS.logDebug(`修改后的回答列表数据:${body}`);
response = { body: body };

View File

@ -3,7 +3,7 @@
[Rule]
# 知乎广告拦截
RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/zhihu/zhihu_remove_ads.list,REJECT-NO-DROP
RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_remove_ads.list,REJECT-NO-DROP
[Map Local]
# 知乎其他广告拦截

View File

@ -5,7 +5,7 @@
# 屏蔽知乎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/zhihu/zhihu_remove_ads.list,REJECT-NO-DROP
RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/zhihu_remove_ads.list,REJECT-NO-DROP
[URL Rewrite]
@ -14,7 +14,7 @@ RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/z
[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"
^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_dict.json" header="Content-Type: application/x-protobuf"
# 知乎去除Tab页关注人头像
^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"
# 知乎去除最常访问