forked from nzw9314/QuantumultX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bilibili.js
100 lines (93 loc) · 3.14 KB
/
Bilibili.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
const up_blacklist = ['NathanRich火锅大王','大祥哥来了'];
const title_blackwords = ['乔碧萝','鸡你太美'];
const region_blacklist = ['宅舞','三次元舞蹈'];
let body = $response.body;
console.log($request.url)
console.log(body)
body = JSON.parse(body);
// 观看页面
if (-1 != $request.url.indexOf('/x/v2/view\?a') && 0 == body['code']) {
body['data']['relates'] = body['data']['relates'].filter(function (item) {
if (item.hasOwnProperty('is_ad')) {
return false;
}
return true;
});
}
// 排行榜
if (-1 != $request.url.indexOf('/x/v2/rank') && 0 == body['code']) {
body['data'] = body['data'].filter(function (item) {
if (up_blacklist.includes(item.name)) {
return false;
}
return true;
});
}
// feed
if (-1 != $request.url.indexOf('/x/v2/feed') && 0 == body['code']) {
body['data']['items'] = body['data']['items'].filter(function (item) {
// search_subscribe 人气UP主推荐
if (['ad_web_s', 'ad_web', 'live', 'banner', 'search_subscribe'].includes(item.card_goto)) {
return false;
}
if (item.hasOwnProperty('ad_info')) {
return false;
}
if (up_blacklist.includes(item.args.up_name)) {
return false;
}
if (region_blacklist.includes(item.args.rname)) {
return false;
}
for( let word of title_blackwords){
if(-1 != item.title.indexOf(word)){
return false;
}
}
return true;
});
}
// 搜索页Banner
if(-1 != $request.url.indexOf('search/resource') && 0 == body['code']){
body['data'] = [];
}
// 评论页面notice
if (-1 != $request.url.indexOf('/x/v2/reply/main') && 0 == body['code']) {
body['data']['notice'] = {};
}
// tab
if (-1 != $request.url.indexOf('resource/show/tab?') && 0 == body['code']) {
// 会员购 动态
body['data']['bottom'] = body['data']['bottom'].filter(function (item) {
return item.id != 180 && item.id != 179
});
// 70 直播 影视
body['data']['tab'] = body['data']['tab'].filter(function (item) {
return item.id != 38247 && item.id != 39 && item.id != 151
});
// 游戏中心
body['data']['top'] = body['data']['top'].filter(function (item) {
return item.id != 175
});
}
// 我的
if (-1 != $request.url.indexOf('/x/v2/account/mine') && 0 == body['code']) {
body['data']['vip_section'] = {};
body['data']['vip_section_v2'] = {};
body['data']['sections'] = body['data']['sections'].filter(
function (item, index) {
if ('创作中心' == item.title) {
return false;
}
item.items = item.items.filter(function (section_items) {
console.log(section_items.title);
if ((['我的关注', '我的钱包', '会员购中心', '直播中心', '青少年模式', '看视频免流量', 'BW 成就'].includes(section_items.title))) {
return false;
}
return true;
});
return true;
});
}
body = JSON.stringify(body);
$done({body});