更新 微博去广告脚本 (powered by @zmqcherish)

This commit is contained in:
sve1r 2022-10-29 12:02:02 +08:00
parent 8e0ff0961f
commit e4241c5dcc
3 changed files with 173 additions and 459 deletions

View File

@ -29,11 +29,13 @@
# 【08.23更新】 删除微博详情页超话新帖和新用户相关提示
# 【09.02更新】 删除初次打开搜索页的轮播图
# 【09.12更新】 修复超话无法签到bug
# 【10.11更新】 移除首页新版广告
# 【10.24更新】 移除用户页新版广告
hostname = api.weibo.cn, mapi.weibo.com, *.uve.weibo.com, new.vip.weibo.cn,
# 微博去广告以及去除各部分推广模块 - cherish
^https?://m?api\.weibo\.c(n|om)/2/(cardlist|searchall|page|messageflow|statuses/(unread_)?friends(/|_)timeline|groups/timeline|statuses/(container_timeline|unread_hot_timeline|extend|video_mixtimeline|unread_topic_timeline)|profile/(me|statuses)|video/(community_tab|remind_info|tiny_stream_video_list)|checkin/show|\!/live/media_homelist|comments/build_comments|container/get_item|search/(finder|container_timeline|container_discover)) url script-response-body https://cdn.jsdelivr.net/gh/zmqcherish/proxy-script@main/weibo_main.js
^https?://m?api\.weibo\.c(n|om)/2/(cardlist|searchall|page|messageflow|statuses/(unread_)?friends(/|_)timeline|groups/timeline|statuses/(container_timeline|unread_hot_timeline|extend|video_mixtimeline|unread_topic_timeline)|profile/(me|container_timeline)|video/(community_tab|remind_info|tiny_stream_video_list)|checkin/show|\!/live/media_homelist|comments/build_comments|container/get_item|search/(finder|container_timeline|container_discover)) url script-response-body https://cdn.jsdelivr.net/gh/zmqcherish/proxy-script@main/weibo_main.js
# 删除微博开屏广告 - cherish
^https?://(sdk|wb)app\.uve\.weibo\.com(/interface/sdk/sdkad.php|/wbapplua/wbpullad.lua) url script-response-body https://cdn.jsdelivr.net/gh/zmqcherish/proxy-script@main/weibo_launch.js

View File

@ -3,17 +3,24 @@
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;
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) {
if(url.indexOf(launchAdUrl2) > -1) {
data = JSON.parse(data);
if (data.cached_ad && data.cached_ad.ads) {
data.cached_ad.ads = [];
@ -25,6 +32,8 @@ function modifyMain(url, data) {
var body = $response.body;
var url = $request.url;
// if(needModify(url)) {
body = modifyMain(url, body);
// }
$done({body});
$done({ body });

File diff suppressed because one or more lines are too long