Skip to content

Commit

Permalink
[BiliBili]首页添加追番tab,追番banner去广告 (blackmatrix7#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
chouchoui authored and blackmatrix7 committed Jan 14, 2022
1 parent 0c72aeb commit bf27db1
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions script/bilibili/bilibili_plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,18 @@ 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
const bottomList = new Set([177, 178, 179, 181, 102, 103, 104, 105, 106]);
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;
}
Expand Down Expand Up @@ -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}`);
Expand Down

0 comments on commit bf27db1

Please sign in to comment.