-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathweibo_launch.js
39 lines (34 loc) · 999 Bytes
/
weibo_launch.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
//参考@yichahucha 的脚本
const launchAdUrl1 = '/interface/sdk/sdkad.php';
const launchAdUrl2 = '/wbapplua/wbpullad.lua';
// function needModify(url) {
// if(url.indexOf(launchAdUrl1) > -1 || url.indexOf(launchAdUrl2) > -1) {
// return true;
// }
// return false;
// }
function modifyMain(url, data) {
if(url.indexOf(launchAdUrl1) > -1) {
let temp = data.match(/\{.*\}/);
if(!temp) return data;
data = JSON.parse(temp);
if (data.ads) data.ads = [];
if (data.background_delay_display_time) data.background_delay_display_time = 60 * 60 * 24 * 1000;
if (data.show_push_splash_ad) data.show_push_splash_ad = false;
return JSON.stringify(data) + 'OK';
}
if(url.indexOf(launchAdUrl2) > -1) {
data = JSON.parse(data);
if (data.cached_ad && data.cached_ad.ads) {
data.cached_ad.ads = [];
}
return JSON.stringify(data);
}
return data;
}
var body = $response.body;
var url = $request.url;
// if(needModify(url)) {
body = modifyMain(url, body);
// }
$done({ body });