forked from yichahucha/surge
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wb_rm_ad.js
40 lines (40 loc) · 1.28 KB
/
wb_rm_ad.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
let path2 = '/2/statuses/';//Feed流广告
let path3 = '/2/statuses/extend';//广告共享计划、相关推荐
let path4 = '/2/comments/build_comments';//评论中相关内容
var result = body;
if (url.indexOf(path2) != -1) {
var json_body = JSON.parse(body);
if (url.indexOf(path3) != -1) {
delete json_body.trend
}else {
var ad = json_body.ad;
if (typeof(ad) != "undefined") {
var statuses = json_body.statuses;
for (let i = 0; i < ad.length; i++) {
const element = ad[i];
let ad_id = element.id;
for (let j = 0; j < statuses.length; j++) {
const element = statuses[j];
let statuses_id = element.id;
if (statuses_id == parseInt(ad_id)) {
statuses.splice(j,1);
}
}
}
}
}
result = JSON.stringify(json_body);
}
if (url.indexOf(path4) != -1) {
var json_body = JSON.parse(body);
var datas = json_body.datas;
for (let j = 0; j < datas.length; j++) {
const element = datas[j];
let type = element.type;
if (type == 5) {
datas.splice(j,1);
}
}
result = JSON.stringify(json_body);
}
result;