From bf27db1d25330a547075ead16c1a4d619345c69d Mon Sep 17 00:00:00 2001 From: chouchoui <14866249+chouchoui@users.noreply.github.com> Date: Tue, 11 Jan 2022 13:51:39 +0800 Subject: [PATCH] =?UTF-8?q?[BiliBili]=E9=A6=96=E9=A1=B5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=BF=BD=E7=95=AAtab=EF=BC=8C=E8=BF=BD=E7=95=AAbanner=E5=8E=BB?= =?UTF-8?q?=E5=B9=BF=E5=91=8A=20(#470)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/bilibili/bilibili_plus.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/script/bilibili/bilibili_plus.js b/script/bilibili/bilibili_plus.js index 77991d4f483..b965425ec2c 100644 --- a/script/bilibili/bilibili_plus.js +++ b/script/bilibili/bilibili_plus.js @@ -83,8 +83,10 @@ if (magicJS.read(blackKey)) { // 标签页处理,如去除会员购等等 case /^https?:\/\/app\.bilibili\.com\/x\/resource\/show\/tab/.test(magicJS.request.url): try { - // 442 开始为概念版id 适配港澳台代理模式 - const tabList = new Set([39, 40, 41, 42, 151, 442, 99, 100, 101, 554, 556]); + // 545 首页追番tab,442 开始为概念版id 适配港澳台代理模式 + const tabList = new Set([39, 40, 41, 545, 151, 442, 99, 100, 101, 554, 556]); + // 尝试使用tab name直观修改 + const tabNameList = new Set(["直播", "推荐", "热门", "追番", "影视"]); // 107 概念版游戏中心,获取修改为Story模式 const topList = new Set([176, 222, 107]); // 102 开始为概念版id @@ -92,7 +94,7 @@ if (magicJS.read(blackKey)) { let obj = JSON.parse(magicJS.response.body); if (obj["data"]["tab"]) { let tab = obj["data"]["tab"].filter((e) => { - return tabList.has(e.id); + return tabNameList.has(e.name); }); obj["data"]["tab"] = tab; } @@ -165,10 +167,12 @@ if (magicJS.read(blackKey)) { case /^https?:\/\/api\.bilibili\.com\/pgc\/page\/bangumi/.test(magicJS.request.url): try { let obj = JSON.parse(magicJS.response.body); - for (let card of obj.data.cards) { - delete card["extra"]; - } - delete obj["data"]["attentions"]; + obj.result.modules.forEach((module) => { + // 头部banner + if (module.style.startsWith("banner")) { + module.items = module.items.filter((i) => !(i.source_content && i.source_content.ad_content)); + } + }); body = JSON.stringify(obj); } catch (err) { magicJS.logError(`追番去广告出现异常:${err}`);