Skip to content

Commit

Permalink
适配知乎关注列表最新接口
Browse files Browse the repository at this point in the history
  • Loading branch information
blackmatrix7 committed Jun 28, 2021
1 parent 597db29 commit ad57422
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion script/zhihu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

此功能并非真正解锁会员特权,只是借用知乎APP的操作界面,通过脚本实现的关键词屏蔽。

与会员真正的屏蔽关键词功能相比,执行效率和匹配范围都较差,所以限制只能设置10个关键词。关键词是与整个JSON字符串进行比较,所以在设置关键词时,尽量不要使用英文和标点,否则一旦和JSON对象的key相同,会导致推荐列表无任何显示。如果一定要使用英文单词和标点,务必清楚自己在做什么。
与会员真正的屏蔽关键词功能相比,执行效率和匹配范围都较差,所以限制只能设置20个关键词。关键词是与整个JSON字符串进行比较,所以在设置关键词时,尽量不要使用英文和标点,否则一旦和JSON对象的key相同,会导致推荐列表无任何显示。如果一定要使用英文单词和标点,务必清楚自己在做什么。

<img src="https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/script/zhihu/images/06.jpg" style="zoom:50%;" />

Expand Down
5 changes: 2 additions & 3 deletions script/zhihu/zhihu_plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const currentUserInfoKey = "zhihu_current_userinfo";
const keywordBlockKey = "zhihu_keyword_block";
// 默认屏蔽推荐列表的用户,通常不是真实用户,无法通过加入黑名单屏蔽
const defaultAnswerBlockedUsers = ["会员推荐"];
const keywordMaxCount = 10; // 允许设置的关键词数量
const keywordMaxCount = 20; // 允许设置的关键词数量
let magicJS = MagicJS(scriptName, "INFO");

(() => {
Expand Down Expand Up @@ -138,7 +138,6 @@ let magicJS = MagicJS(scriptName, "INFO");
// 推荐去广告与黑名单增强
case /^https:\/\/api\.zhihu\.com\/topstory\/recommend\?/.test(magicJS.request.url):
try {

// 判断是否是“盐选推荐内容”
function IsYanXuan(element) {
let flag = false;
Expand Down Expand Up @@ -257,7 +256,7 @@ let magicJS = MagicJS(scriptName, "INFO");
let element = targetIdFix(obj["data"][i]);
if (!element["ad"]) {
// 判断转发的想法是否含有黑名单用户
if (element.target.origin_pin && element.target.origin_pin.author && customBlockedUsers[element.target.origin_pin.author.name]) {
if (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 {
data.push(element);
Expand Down

0 comments on commit ad57422

Please sign in to comment.