[哲也同学] 新版信息流优化

This commit is contained in:
blackmatrix7 2022-12-25 23:32:19 +08:00
parent 4a0f50b191
commit 168874bf69
6 changed files with 1092 additions and 1046 deletions

View File

@ -12,7 +12,7 @@ https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhe
### Quantumult X ### Quantumult X
重写文件 重写
```shell ```shell
https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.qxrewrite https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.qxrewrite

View File

@ -14,7 +14,7 @@ const $ = MagicJS(scriptName, "INFO");
* @return {*} * @return {*}
*/ */
function getUserInfo() { function getUserInfo() {
let defaultUserInfo = { id: "default", is_vip: false }; let defaultUserInfo = {id: "default", is_vip: false};
try { try {
let userInfo = $.data.read(currentUserInfoKey); let userInfo = $.data.read(currentUserInfoKey);
if (typeof userInfo === "string") userInfo = JSON.parse(userInfo); if (typeof userInfo === "string") userInfo = JSON.parse(userInfo);
@ -77,7 +77,7 @@ function modifyAppConfig() {
"ZHHTTPSessionManager_setupZHHTTPHeaderField" "ZHHTTPSessionManager_setupZHHTTPHeaderField"
] = "1"; ] = "1";
} }
response = { body: JSON.stringify(obj) }; response = {body: JSON.stringify(obj)};
} }
} catch (err) { } catch (err) {
$.logger.error(`优化软件配置出现异常:${err}`); $.logger.error(`优化软件配置出现异常:${err}`);
@ -106,7 +106,7 @@ function modifyMCloudConfig() {
} }
const body = JSON.stringify(obj); const body = JSON.stringify(obj);
$.logger.debug(body); $.logger.debug(body);
response = { body: body }; response = {body: body};
} }
} catch (err) { } catch (err) {
$.logger.error(`优化软件配置出现异常:${err}`); $.logger.error(`优化软件配置出现异常:${err}`);
@ -149,9 +149,9 @@ function unlockBlockedKeywords() {
data: keywords, data: keywords,
}); });
if ($.env.isQuanX) { if ($.env.isQuanX) {
response = { body: body, headers: headers, status: "HTTP/1.1 200 OK" }; response = {body: body, headers: headers, status: "HTTP/1.1 200 OK"};
} else { } else {
response = { response: { body: body, headers: headers, status: 200 } }; response = {response: {body: body, headers: headers, status: 200}};
} }
$.logger.debug(`获取本地脚本屏蔽关键词:\n${keywords.join("、")}`); $.logger.debug(`获取本地脚本屏蔽关键词:\n${keywords.join("、")}`);
} }
@ -192,7 +192,7 @@ function unlockBlockedKeywords() {
if (keywordExists === false) { if (keywordExists === false) {
keywords.push(keyword); keywords.push(keyword);
$.data.write(keywordBlockKey, keywords, userInfo.id); $.data.write(keywordBlockKey, keywords, userInfo.id);
let body = JSON.stringify({ success: true }); let body = JSON.stringify({success: true});
if ($.env.isQuanX) { if ($.env.isQuanX) {
response = { response = {
body: body, body: body,
@ -201,7 +201,7 @@ function unlockBlockedKeywords() {
}; };
} else { } else {
response = { response = {
response: { body: body, headers: headers, status: 200 }, response: {body: body, headers: headers, status: 200},
}; };
} }
$.logger.debug(`添加本地脚本屏蔽关键词“${keyword}`); $.logger.debug(`添加本地脚本屏蔽关键词“${keyword}`);
@ -220,7 +220,7 @@ function unlockBlockedKeywords() {
}; };
} else { } else {
response = { response = {
response: { body: body, headers: headers, status: 400 }, response: {body: body, headers: headers, status: 400},
}; };
} }
} }
@ -250,11 +250,11 @@ function unlockBlockedKeywords() {
"X-Cache-Lookup": "Cache Miss", "X-Cache-Lookup": "Cache Miss",
"x-cdn-provider": "tencent", "x-cdn-provider": "tencent",
}; };
let body = JSON.stringify({ success: true }); let body = JSON.stringify({success: true});
if ($.env.isQuanX) { if ($.env.isQuanX) {
response = { body: body, headers: headers, status: "HTTP/1.1 200 OK" }; response = {body: body, headers: headers, status: "HTTP/1.1 200 OK"};
} else { } else {
response = { response: { body: body, headers: headers, status: 200 } }; response = {response: {body: body, headers: headers, status: 200}};
} }
$.logger.debug(`删除本地脚本屏蔽关键词:“${keyword}`); $.logger.debug(`删除本地脚本屏蔽关键词:“${keyword}`);
} }
@ -344,7 +344,7 @@ function processUserInfo() {
"card_jump_url": "zhihu://market/home" "card_jump_url": "zhihu://market/home"
}; };
$.logger.debug("设置用户为本地盐选会员"); $.logger.debug("设置用户为本地盐选会员");
response = { body: JSON.stringify(obj) }; response = {body: JSON.stringify(obj)};
} }
} else { } else {
$.logger.warning( $.logger.warning(
@ -494,7 +494,7 @@ function autoInsertBlackList() {
let obj = JSON.parse($.response.body); let obj = JSON.parse($.response.body);
// 删除MCN信息 // 删除MCN信息
delete obj["mcn_user_info"]; delete obj["mcn_user_info"];
response = { body: JSON.stringify(obj) }; response = {body: JSON.stringify(obj)};
// 如已是黑名单用户,但不在脚本黑名单中,则自动加入 // 如已是黑名单用户,但不在脚本黑名单中,则自动加入
if (obj.name && obj.id && obj["is_blocking"] === true) { if (obj.name && obj.id && obj["is_blocking"] === true) {
const userInfo = getUserInfo(); const userInfo = getUserInfo();
@ -559,7 +559,7 @@ function removeMoments() {
} }
) )
obj["data"] = data; obj["data"] = data;
response = { body: JSON.stringify(obj) }; response = {body: JSON.stringify(obj)};
} catch (err) { } catch (err) {
$.logger.error(`关注列表去广告出现异常:${err}`); $.logger.error(`关注列表去广告出现异常:${err}`);
} }
@ -629,7 +629,8 @@ function removeRecommend() {
try { try {
actionUrl = actionUrl =
element["common_card"]["feed_content"]["title"]["action"]["intent_url"]; element["common_card"]["feed_content"]["title"]["action"]["intent_url"];
} catch { } } catch {
}
$.logger.debug( $.logger.debug(
`匹配关键字:\n${keywords[i]}\n标题:\n${elementTitle}\n内容:\n${elementContent}` `匹配关键字:\n${keywords[i]}\n标题:\n${elementTitle}\n内容:\n${elementContent}`
); );
@ -677,7 +678,7 @@ function removeRecommend() {
$.notification.post("所有推荐内容都已被过滤,建议调整脚本过滤配置。") $.notification.post("所有推荐内容都已被过滤,建议调整脚本过滤配置。")
} }
obj["data"] = obj["data"].filter(newData); obj["data"] = obj["data"].filter(newData);
response = { body: JSON.stringify(obj) }; response = {body: JSON.stringify(obj)};
} catch (err) { } catch (err) {
$.logger.error(`推荐列表去广告出现异常:${err}`); $.logger.error(`推荐列表去广告出现异常:${err}`);
} }
@ -725,8 +726,7 @@ function removeQuestions() {
} }
if (!removeBlackUserAnswer) { if (!removeBlackUserAnswer) {
newData.push(element); newData.push(element);
} } else if (removeBlackUserAnswer === true && blackUserAnswersId.includes(answerId) === false) {
else if (removeBlackUserAnswer === true && blackUserAnswersId.includes(answerId) === false){
blackUserAnswersId.push(answerId); blackUserAnswersId.push(answerId);
$.notification.debug(`记录黑名单用户${blackUserName}的回答Id:${answerId}`); $.notification.debug(`记录黑名单用户${blackUserName}的回答Id:${answerId}`);
} }
@ -736,7 +736,7 @@ function removeQuestions() {
$.data.write(blackAnswersIdKey, blackUserAnswersId); $.data.write(blackAnswersIdKey, blackUserAnswersId);
const body = JSON.stringify(obj); const body = JSON.stringify(obj);
$.logger.debug(`修改后的回答列表数据:${body}`); $.logger.debug(`修改后的回答列表数据:${body}`);
response = { body: body }; response = {body: body};
} catch (err) { } catch (err) {
$.logger.error(`回答列表去广告出现异常:${err}`); $.logger.error(`回答列表去广告出现异常:${err}`);
} }
@ -778,7 +778,7 @@ function modifyAnswer() {
if (insertText !== "") { if (insertText !== "") {
const matchStr = html.match(/(richText[^<]*>)(.)/)[1]; const matchStr = html.match(/(richText[^<]*>)(.)/)[1];
const start = html.lastIndexOf(matchStr) + matchStr.length; const start = html.lastIndexOf(matchStr) + matchStr.length;
response = { body: html.slice(0, start) + insertText + html.slice(start) }; response = {body: html.slice(0, start) + insertText + html.slice(start)};
} }
} catch (err) { } catch (err) {
@ -861,7 +861,7 @@ function removeComment() {
comment.child_comments.forEach((childComment) => { comment.child_comments.forEach((childComment) => {
// 屏蔽黑名单用户的评论 // 屏蔽黑名单用户的评论
const childCommentUserName = childComment.author.name; const childCommentUserName = childComment.author.name;
const childCommentReplyUserName = typeof childComment["reply_to_author"] != "undefined" ? childComment["reply_to_author"].name: ""; const childCommentReplyUserName = typeof childComment["reply_to_author"] != "undefined" ? childComment["reply_to_author"].name : "";
const isChildBlackCommentUser = typeof customBlockedUsers[childCommentUserName] != "undefined"; const isChildBlackCommentUser = typeof customBlockedUsers[childCommentUserName] != "undefined";
const isChildBlackReplyUser = typeof customBlockedUsers[childCommentReplyUserName] != "undefined"; const isChildBlackReplyUser = typeof customBlockedUsers[childCommentReplyUserName] != "undefined";
if (isChildBlackCommentUser || isChildBlackReplyUser) { if (isChildBlackCommentUser || isChildBlackReplyUser) {
@ -897,7 +897,7 @@ function removeComment() {
} }
const body = JSON.stringify(obj); const body = JSON.stringify(obj);
$.logger.debug(`过滤后的评论数据:\n${body}`); $.logger.debug(`过滤后的评论数据:\n${body}`);
response = { body: body }; response = {body: body};
} }
} catch (err) { } catch (err) {
$.logger.error(`去除评论广告出现异常:${err}`); $.logger.error(`去除评论广告出现异常:${err}`);
@ -917,7 +917,7 @@ function removeArticleAd() {
obj["ad_info"] = {}; obj["ad_info"] = {};
const body = JSON.stringify(obj); const body = JSON.stringify(obj);
$.logger.debug(`过滤后的文章数据:\n${body}`); $.logger.debug(`过滤后的文章数据:\n${body}`);
response = { body: body }; response = {body: body};
} }
} catch (err) { } catch (err) {
$.logger.error(`去除文章广告出现异常:${err}`); $.logger.error(`去除文章广告出现异常:${err}`);
@ -951,7 +951,7 @@ function removeMarketingMsg() {
} }
} }
obj["data"] = newItems; obj["data"] = newItems;
response = { body: JSON.stringify(obj) }; response = {body: JSON.stringify(obj)};
} catch (err) { } catch (err) {
$.logger.error(`屏蔽官方营销消息出现异常:${err}`); $.logger.error(`屏蔽官方营销消息出现异常:${err}`);
} }
@ -975,7 +975,7 @@ function removeHotListAds() {
); );
}); });
} }
response = { body: JSON.stringify(obj) }; response = {body: JSON.stringify(obj)};
} }
} catch (err) { } catch (err) {
$.logger.error(`去除热榜广告出现异常:${err}`); $.logger.error(`去除热榜广告出现异常:${err}`);
@ -998,7 +998,7 @@ function removeKeywordAds() {
obj["preset_words"]["words"] = obj["preset_words"]["words"].filter((element) => { obj["preset_words"]["words"] = obj["preset_words"]["words"].filter((element) => {
return element["type"] !== "ad"; return element["type"] !== "ad";
}); });
response = { body: JSON.stringify(obj) }; response = {body: JSON.stringify(obj)};
} }
} }
} catch (err) { } catch (err) {
@ -1012,38 +1012,37 @@ function removeKeywordAds() {
* 小概率会移除失败 * 小概率会移除失败
* @return {*} * @return {*}
*/ */
function removeNextBlackUserAnswer(){ function removeNextBlackUserAnswer() {
let response = null; let response = null;
try { try {
if (!!$.response.body) { if (!!$.response.body) {
let obj = JSON.parse($.response.body); let obj = JSON.parse($.response.body);
const blackUserAnswersId = $.data.read(blackAnswersIdKey, []); const blackUserAnswersId = $.data.read(blackAnswersIdKey, []);
if (blackUserAnswersId.length > 0){ if (blackUserAnswersId.length > 0) {
let newData = []; let newData = [];
obj.data.forEach(element => { obj.data.forEach(element => {
const tag = blackUserAnswersId.includes(element.id.toString()); const tag = blackUserAnswersId.includes(element.id.toString());
if (tag === false){ if (tag === false) {
// 去除可能的广告 // 去除可能的广告
element.ad_info = {"data": ""}; element.ad_info = {"data": ""};
newData.push(element); newData.push(element);
} } else {
else {
$.notification.debug(`屏蔽翻页过程中出现的黑名单用户回答Id:${element.id}`); $.notification.debug(`屏蔽翻页过程中出现的黑名单用户回答Id:${element.id}`);
} }
}); });
// 重新为答案排序 // 重新为答案排序
for(let i=0; i < newData.length; i++){ for (let i = 0; i < newData.length; i++) {
if (newData[i]["extra"] && newData[i]["extra"]["question_index"]){ if (newData[i]["extra"] && newData[i]["extra"]["question_index"]) {
newData[i]["extra"]["question_index"] = i+1; newData[i]["extra"]["question_index"] = i + 1;
} }
if (newData[i]["strategy_info"]){ if (newData[i]["strategy_info"]) {
newData[i]["strategy_info"]["global_index"] = i+1; newData[i]["strategy_info"]["global_index"] = i + 1;
newData[i]["strategy_info"]["strategy_index"] = i+1; newData[i]["strategy_info"]["strategy_index"] = i + 1;
} }
} }
obj.data = newData; obj.data = newData;
} }
response = { body: JSON.stringify(obj) }; response = {body: JSON.stringify(obj)};
} }
} catch (err) { } catch (err) {
$.logger.error(`屏蔽下翻黑名单用户的回答出现异常:${err}`); $.logger.error(`屏蔽下翻黑名单用户的回答出现异常:${err}`);
@ -1051,12 +1050,38 @@ function removeNextBlackUserAnswer(){
return response; return response;
} }
function modifyAnswersNextData() {
let response = null;
try {
if (!!$.response.body) {
let obj = JSON.parse($.response.body);
let user_info = getUserInfo();
let customBlockedUsers = $.data.read(blockedUsersKey, {}, user_info.id);
$.logger.debug(`脚本黑名单用户:\n${JSON.stringify(customBlockedUsers)}`);
let newData = [];
obj.data.data.forEach(element => {
element["ad_info"] = {"data": ""};
const isBlackUser = typeof customBlockedUsers[element.data.author.name] != "undefined";
$.logger.debug(`用户${element.data.author.name}是否在黑名单中:${isBlackUser}`);
if ($.data.read("zhihu_settings_blocked_users", false) === false || isBlackUser === false) {
newData.push(element);
}
})
obj.data.data = newData;
response = {body: JSON.stringify(obj)};
}
} catch (err) {
$.logger.error(`屏蔽回答信息流黑名单用户及广告:${err}`);
}
return response;
}
/** /**
* 修改盐值 * 修改盐值
* *
* @return {*} * @return {*}
*/ */
function changeUserCredit(){ function changeUserCredit() {
$.notification.debug("开始修改用户盐值"); $.notification.debug("开始修改用户盐值");
let response = null; let response = null;
try { try {
@ -1065,11 +1090,11 @@ function changeUserCredit(){
const score = parseInt($.data.read(userCreditScore, 780)); const score = parseInt($.data.read(userCreditScore, 780));
$.logger.debug(`准备修改用户盐值为${score}`); $.logger.debug(`准备修改用户盐值为${score}`);
let obj = JSON.parse($.response.body); let obj = JSON.parse($.response.body);
if (obj["credit_basis"].total_score < score){ if (obj["credit_basis"].total_score < score) {
obj["credit_basis"].total_score = score; obj["credit_basis"].total_score = score;
$.logger.debug(`已修改用户盐值为:${score}`); $.logger.debug(`已修改用户盐值为:${score}`);
} }
response = { body: JSON.stringify(obj) }; response = {body: JSON.stringify(obj)};
} }
} catch (err) { } catch (err) {
$.logger.error(`修改用户盐值出现异常:${err}`); $.logger.error(`修改用户盐值出现异常:${err}`);
@ -1107,6 +1132,10 @@ function changeUserCredit(){
case /^https?:\/\/api\.zhihu\.com\/(v4\/)?questions\/\d+/.test($.request.url): case /^https?:\/\/api\.zhihu\.com\/(v4\/)?questions\/\d+/.test($.request.url):
response = removeQuestions(); response = removeQuestions();
break; break;
// 回答信息流 - 移除黑名单用户的回答、去除广告
case /^https?:\/\/api\.zhihu\.com\/next-data\?/.test($.request.url):
response = modifyAnswersNextData();
break;
// 消息页 - 折叠官方消息、屏蔽营销消息 // 消息页 - 折叠官方消息、屏蔽营销消息
case $.data.read("zhihu_settings_sys_msg", true) !== false && case $.data.read("zhihu_settings_sys_msg", true) !== false &&
/^https?:\/\/api\.zhihu\.com\/notifications\/v3\/message/.test($.request.url): /^https?:\/\/api\.zhihu\.com\/notifications\/v3\/message/.test($.request.url):

View File

@ -1,9 +1,9 @@
#!name= 哲也同学 #!name=哲也同学
#!desc= 哲也同学,你的阅读小助手 #!desc=哲也同学,你的阅读小助手
#!openUrl= https://github.com/blackmatrix7/ios_rule_script #!openUrl=https://github.com/blackmatrix7/ios_rule_script
#!author= blackmatrix7 #!author=blackmatrix7
#!homepage= https://github.com/blackmatrix7/ios_rule_script #!homepage=https://github.com/blackmatrix7/ios_rule_script
#!icon= https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.png #!icon=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.png
[Rule] [Rule]
# 拦截开屏广告 # 拦截开屏广告
@ -40,53 +40,56 @@ DOMAIN,appcloud2.in.zhihu.com,REJECT
[Script] [Script]
# 获取用户信息 - 隔离用户数据,开启本地盐选会员等 # 获取用户信息 - 隔离用户数据,开启本地盐选会员等
http-response ^https?:\/\/api\.zhihu\.com\/people\/ requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=知乎_处理用户信息 http-response ^https?:\/\/api\.zhihu\.com\/people\/ requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=处理用户信息
# 解锁本地的关键词屏蔽功能需要开启本地VIP # 解锁本地的关键词屏蔽功能需要开启本地VIP
http-request ^https?:\/\/api\.zhihu\.com\/feed-root\/block requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=知乎_解锁关键词屏蔽 http-request ^https?:\/\/api\.zhihu\.com\/feed-root\/block script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=解锁关键词屏蔽
# 优化知乎软件配置 - 优化下发的配置文件来实现某些效果 # 优化软件配置 - 优化下发的配置文件来实现某些效果
http-response ^https?:\/\/m-cloud\.zhihu\.com\/api\/cloud\/config\/all\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=知乎_优化软件配置1 http-response ^https?:\/\/m-cloud\.zhihu\.com\/api\/cloud\/config\/all\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=优化软件配置1
http-response ^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=知乎_优化软件配置2 http-response ^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=优化软件配置2
# 用户信息 - 修改用户盐值 # 用户信息 - 修改用户盐值
http-response ^https?:\/\/api\.zhihu\.com\/user-credit\/basis requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=知乎_修改用户盐值 http-response ^https?:\/\/api\.zhihu\.com\/user-credit\/basis requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=修改用户盐值
# 关注页 - 内容优化及屏蔽转发的黑名单用户想法 # 关注页 - 内容优化及屏蔽转发的黑名单用户想法
http-response ^https?:\/\/api\.zhihu\.com\/moments_v3\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=知乎_关注列表优化 http-response ^https?:\/\/api\.zhihu\.com\/moments_v3\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=关注列表优化
# 推荐页 - 移除黑名单用户发布的文章、去除广告,及自定义一些屏蔽项目 # 推荐页 - 移除黑名单用户发布的文章、去除广告,及自定义一些屏蔽项目
http-response ^https:\/\/api\.zhihu\.com\/topstory\/recommend\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=知乎_推荐页优化 http-response ^https:\/\/api\.zhihu\.com\/topstory\/recommend\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.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/zheye/zheye.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/zheye/zheye.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/zheye/zheye.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/zheye/zheye.js,tag=回答列表优化
# 回答信息流 - 移除黑名单用户的回答、去除广告
^https?:\/\/api\.zhihu\.com\/next-data requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=回答信息流优化
# 回答页底部评论摘要 - 移除黑名单用户发表的评论 # 回答页底部评论摘要 - 移除黑名单用户发表的评论
http-response ^https?:\/\/www\.zhihu\.com\/api\/v4\/comment_v5\/answers\/\d+\/abstract_comment\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=知乎_评论摘要优化 http-response ^https?:\/\/www\.zhihu\.com\/api\/v4\/comment_v5\/answers\/\d+\/abstract_comment\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.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/zheye/zheye.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/zheye/zheye.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/zheye/zheye.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/zheye/zheye.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/zheye/zheye.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/zheye/zheye.js,tag=回答内容优化
# 回答页 - 屏蔽下翻出现的黑名单用户的回答 # 回答页 - 屏蔽下翻出现的黑名单用户的回答
http-response ^https?:\/\/api\.zhihu\.com\/next\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=知乎_回答翻页优化 http-response ^https?:\/\/api\.zhihu\.com\/next\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=回答翻页优化
# 文章页 - 去除底部广告 # 文章页 - 去除底部广告
http-response ^https?:\/\/www\.zhihu\.com\/api\/v\d\/articles\/\d+\/recommendation\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js,tag=知乎_文章优化 http-response ^https?:\/\/www\.zhihu\.com\/api\/v\d\/articles\/\d+\/recommendation\? requires-body=1,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.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/zheye/zheye.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/zheye/zheye.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/zheye/zheye.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/zheye/zheye.js,tag=预置关键词优化
[MITM] [MITM]
hostname = 118.89.204.198,2402:4e00:1200:ed00:0:9089:6dac:96b6,www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,appcloud2.zhihu.com,m-cloud.zhihu.com,103.41.167.236,103.41.167.234,103.41.167.235,103.41.167.226 hostname = 118.89.204.198,2402:4e00:1200:ed00:0:9089:6dac:96b6,www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,appcloud2.zhihu.com,m-cloud.zhihu.com,103.41.167.236,103.41.167.234,103.41.167.235,103.41.167.226

View File

@ -37,53 +37,56 @@ DOMAIN,appcloud2.in.zhihu.com,REJECT
[Script] [Script]
# 获取用户信息 - 隔离用户数据,开启本地盐选会员等 # 获取用户信息 - 隔离用户数据,开启本地盐选会员等
知乎_处理用户信息 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/people\/,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 处理用户信息 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/people\/,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 解锁本地的关键词屏蔽功能需要开启本地VIP # 解锁本地的关键词屏蔽功能需要开启本地VIP
知乎_解锁关键词屏蔽 = type=http-request,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/feed-root\/block,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 解锁关键词屏蔽 = type=http-request,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/feed-root\/block,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 优化知乎软件配置 - 优化下发的配置文件来实现某些效果 # 优化软件配置 - 优化下发的配置文件来实现某些效果
知乎_优化软件配置1 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/m-cloud\.zhihu\.com\/api\/cloud\/config\/all\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 优化软件配置1 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/m-cloud\.zhihu\.com\/api\/cloud\/config\/all\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
知乎_优化软件配置2 = 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/zheye/zheye.js 优化软件配置2 = 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/zheye/zheye.js
# 用户信息 - 修改用户盐值 # 用户信息 - 修改用户盐值
知乎_修改用户盐值 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/user-credit\/basis,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 修改用户盐值 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/user-credit\/basis,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 关注页 - 内容优化及屏蔽转发的黑名单用户想法 # 关注页 - 内容优化及屏蔽转发的黑名单用户想法
知乎_关注列表优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/moments_v3\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 关注列表优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/moments_v3\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 推荐页 - 移除黑名单用户发布的文章、去除广告,及自定义一些屏蔽项目 # 推荐页 - 移除黑名单用户发布的文章、去除广告,及自定义一些屏蔽项目
知乎_推荐页优化 = type=http-response,requires-body=1,max-size=0,pattern=^https:\/\/api\.zhihu\.com\/topstory\/recommend\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 推荐页优化 = type=http-response,requires-body=1,max-size=0,pattern=^https:\/\/api\.zhihu\.com\/topstory\/recommend\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 黑名单页 - 同步黑名单数据 # 黑名单页 - 同步黑名单数据
知乎_同步黑名单 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/settings\/blocked_users,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 同步黑名单 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/settings\/blocked_users,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 问题的回答列表 - 移除黑名单用户的回答、去除广告 # 问题的回答列表 - 移除黑名单用户的回答、去除广告
知乎_回答列表优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/(v4\/)?questions\/\d+,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 回答列表优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/(v4\/)?questions\/\d+,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 回答信息流 - 移除黑名单用户的回答、去除广告
回答信息流优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/next-data,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 回答页底部评论摘要 - 移除黑名单用户发表的评论 # 回答页底部评论摘要 - 移除黑名单用户发表的评论
知乎_评论摘要优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/www\.zhihu\.com\/api\/v4\/comment_v5\/answers\/\d+\/abstract_comment\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 评论摘要优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/www\.zhihu\.com\/api\/v4\/comment_v5\/answers\/\d+\/abstract_comment\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.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://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.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://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.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://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.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://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.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://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.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://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 回答页 - 屏蔽下翻出现的黑名单用户的回答 # 回答页 - 屏蔽下翻出现的黑名单用户的回答
知乎_回答翻页优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/next\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 回答翻页优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/next\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 文章页 - 去除底部广告 # 文章页 - 去除底部广告
知乎_文章优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/www\.zhihu\.com\/api\/v\d\/articles\/\d+\/recommendation\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 文章优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/www\.zhihu\.com\/api\/v\d\/articles\/\d+\/recommendation\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 热榜页 - 去除广告 # 热榜页 - 去除广告
知乎_热榜优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists(\?|\/),script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 热榜优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/topstory\/hot-lists(\?|\/),script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 搜索页 - 去除预置广告 # 搜索页 - 去除预置广告
知乎_预置关键词优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/search\/preset_words\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js 预置关键词优化 = type=http-response,requires-body=1,max-size=0,pattern=^https?:\/\/api\.zhihu\.com\/search\/preset_words\?,script-path=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
[MITM] [MITM]
hostname = %APPEND% 118.89.204.198,2402:4e00:1200:ed00:0:9089:6dac:96b6,www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,appcloud2.zhihu.com,m-cloud.zhihu.com,103.41.167.236,103.41.167.234,103.41.167.235,103.41.167.226 hostname = %APPEND% 118.89.204.198,2402:4e00:1200:ed00:0:9089:6dac:96b6,www.zhihu.com,api.zhihu.com,zhuanlan.zhihu.com,appcloud2.zhihu.com,m-cloud.zhihu.com,103.41.167.236,103.41.167.234,103.41.167.235,103.41.167.226

View File

@ -5,7 +5,7 @@
^https?:\/\/118\.89\.204\.198 url reject-200 ^https?:\/\/118\.89\.204\.198 url reject-200
^https?:\/\/2402:4e00:1200:ed00:0:9089:6dac:96b6 url reject-200 ^https?:\/\/2402:4e00:1200:ed00:0:9089:6dac:96b6 url reject-200
# 拦截知乎开屏广告 # 拦截开屏广告
^https?:\/\/api\.zhihu\.com\/commercial_api\/launch_v2\? url reject-dict ^https?:\/\/api\.zhihu\.com\/commercial_api\/launch_v2\? url reject-dict
^https?:\/\/api\.zhihu\.com\/commercial_api\/real_time_launch_v2\? url reject-dict ^https?:\/\/api\.zhihu\.com\/commercial_api\/real_time_launch_v2\? url reject-dict
@ -40,7 +40,7 @@
# 解锁本地的关键词屏蔽功能需要开启本地VIP # 解锁本地的关键词屏蔽功能需要开启本地VIP
^https?:\/\/api\.zhihu\.com\/feed-root\/block url script-analyze-echo-response https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js ^https?:\/\/api\.zhihu\.com\/feed-root\/block url script-analyze-echo-response https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 优化知乎软件配置 - 优化下发的配置文件来实现某些效果 # 优化软件配置 - 优化下发的配置文件来实现某些效果
^https?:\/\/m-cloud\.zhihu\.com\/api\/cloud\/config\/all\? url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js ^https?:\/\/m-cloud\.zhihu\.com\/api\/cloud\/config\/all\? url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config url script-analyze-echo-response https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js ^https?:\/\/appcloud2\.zhihu\.com\/v\d+\/config url script-analyze-echo-response https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
@ -59,6 +59,9 @@
# 问题的回答列表 - 移除黑名单用户的回答、去除广告 # 问题的回答列表 - 移除黑名单用户的回答、去除广告
^https?:\/\/api\.zhihu\.com\/(v4\/)?questions\/\d+ url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js ^https?:\/\/api\.zhihu\.com\/(v4\/)?questions\/\d+ url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 回答信息流 - 移除黑名单用户的回答、去除广告
^https?:\/\/api\.zhihu\.com\/next-data url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js
# 回答页底部评论摘要 - 移除黑名单用户发表的评论 # 回答页底部评论摘要 - 移除黑名单用户发表的评论
^https?:\/\/www\.zhihu\.com\/api\/v4\/comment_v5\/answers\/\d+\/abstract_comment\? url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js ^https?:\/\/www\.zhihu\.com\/api\/v4\/comment_v5\/answers\/\d+\/abstract_comment\? url script-response-body https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zheye/zheye.js

View File

@ -45,7 +45,7 @@ http:
timeout: 30 timeout: 30
argument: '' argument: ''
# 优化知乎软件配置 - 优化下发的配置文件来实现某些效果 # 优化软件配置 - 优化下发的配置文件来实现某些效果
- match: ^https?:\/\/m-cloud\.zhihu\.com\/api\/cloud\/config\/all\? - match: ^https?:\/\/m-cloud\.zhihu\.com\/api\/cloud\/config\/all\?
name: zheye.js name: zheye.js
type: response type: response
@ -99,6 +99,14 @@ http:
timeout: 30 timeout: 30
argument: '' argument: ''
# 回答信息流 - 移除黑名单用户的回答、去除广告
- match: ^https?:\/\/api\.zhihu\.com\/next-data
name: zheye.js
type: response
require-body: true
timeout: 30
argument: ''
# 回答页底部评论摘要 - 移除黑名单用户发表的评论 # 回答页底部评论摘要 - 移除黑名单用户发表的评论
- match: ^https?:\/\/www\.zhihu\.com\/api\/v4\/comment_v5\/answers\/\d+\/abstract_comment\? - match: ^https?:\/\/www\.zhihu\.com\/api\/v4\/comment_v5\/answers\/\d+\/abstract_comment\?
name: zheye.js name: zheye.js