diff --git a/script/zhihu/README.md b/script/zhihu/README.md index c84f8a5c7..821e9bbce 100644 --- a/script/zhihu/README.md +++ b/script/zhihu/README.md @@ -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 ``` ## 其他问题 diff --git a/script/zhihu/zhihu.js b/script/zhihu/zhihu.js index 4c30ed26f..97bd4945c 100644 --- a/script/zhihu/zhihu.js +++ b/script/zhihu/zhihu.js @@ -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 }; diff --git a/script/zhihu/zhihu_lite.sgmodule b/script/zhihu/zhihu_lite.sgmodule index 81e5a424b..084741738 100644 --- a/script/zhihu/zhihu_lite.sgmodule +++ b/script/zhihu/zhihu_lite.sgmodule @@ -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] # 知乎其他广告拦截 diff --git a/script/zhihu/zhihu_plus.sgmodule b/script/zhihu/zhihu_plus.sgmodule index 677b7f4da..aeb4c7b22 100644 --- a/script/zhihu/zhihu_plus.sgmodule +++ b/script/zhihu/zhihu_plus.sgmodule @@ -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" # 知乎去除最常访问