From fde0e122fa90271db09c98b173619483dfc7c52b Mon Sep 17 00:00:00 2001 From: sve1r Date: Thu, 12 Jan 2023 14:07:39 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=A3=20feat:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=BE=AE=E5=8D=9A=E7=9B=B8=E5=85=B3=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rewrite/AdBlock/Weibo.conf | 30 +++++--- Scripts/AdBlock/Weibo/weibo_json.js | 108 ++++++++++++++++------------ 2 files changed, 84 insertions(+), 54 deletions(-) diff --git a/Rewrite/AdBlock/Weibo.conf b/Rewrite/AdBlock/Weibo.conf index 5322ff1..1c05606 100644 --- a/Rewrite/AdBlock/Weibo.conf +++ b/Rewrite/AdBlock/Weibo.conf @@ -6,12 +6,12 @@ // @TgChannel https://t.me/ddgksf2021 // @Contribute https://t.me/ddgksf2013_bot // @Feedback 📮 ddgksf2013@163.com 📮 -// @UpdateTime 2022-12-25 +// @UpdateTime 2023-01-08 // @Attention 微博、微博国际版净化,现已二合一,使用中若有问题请发邮件! // @Function 让你更加愉悦的刷微博 // @Suitable 自行观看“# > ”注释内容 // @Attention 如需引用请注明出处,谢谢合作! -// @Version V2.0.14 +// @Version V2.0.49 // @ScriptURL https://github.com/ddgksf2013/Rewrite/raw/master/AdBlock/Weibo.conf // ==/UserScript== @@ -35,7 +35,7 @@ # [+]2022-09-02 17、删除初次打开搜索页的轮播图 # [+]2022-09-12 18、修复超话无法签到bug # [+]2022-10-11 19、移除首页新版广告 -# [+]2022-10-24 20、移除用户页新版广告 +# [+]2022-10-24 20、移除用户页新版广告🍁以上1-20条为@zmqcherish所写,下面21条开始为@墨鱼所写🍁 # [+]2022-12-14 21、将微博国际版去广告与微博去广告二合一,删除微博发现页的轮播图,add key removeSearchWindow for true # [+]2022-12-15 22、更换微博国际版去广告的search_topic # [+]2022-12-15 23、微博国际版去广告不再采用单一reject方式,利用脚本去广告 @@ -54,19 +54,33 @@ # [+]2022-12-24 36、删除发现页下拉刷新时的背景广告图片,瞬间清爽 # [+]2022-12-24 37、删除微博短视频流中的广告,让你无广告享受刷短视频的快感 # [+]2022-12-25 38、删除搜索页面热搜顶部偶尔出现的HotSearchPush +# [+]2022-12-27 39、删除微博用户页“可能感兴趣的人”内容 +# [+]2022-12-29 40、删除微博信息流中商品橱窗内容(并未将整个CARD一起删除) +# [+]2023-01-01 41、删除微博首页顶部感兴趣的人group推荐,并兼容微博国际版 +# [+]2023-01-03 42、去除微博国际版热搜列表的置顶内容 +# [+]2023-01-05 43、添加屏蔽sdkconfig请求及应用内弹窗广告请求 +# [+]2023-01-06 44、去除微博我的页面中Myname后面的续费VIP_Icon内容 +# [+]2023-01-08 45、屏蔽发现页面顶部搜索框热词,将热词恢复为‘搜索’ + hostname = *api.weibo*, *uve.weibo.com, new.vip.weibo.cn # > 微博_请手动添加以下分流至本地 #host, sdkapp.uve.weibo.com, direct +# > 微博_屏蔽发现页面搜索框热词@ddgksf2013 +^https?:\/\/m?api\.weibo\.c(n|om)\/\d\/\w{5}\/cardlist url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js +# > 微博_应用内弹窗广告@ddgksf2013 +^https?:\/\/(preload-click|preload-impression)\.uve\.weibo\.com\/(interface\/wbpullad\/wbpullad_click\.php|wbapplua\/get_wbpullad_log\.lua) url reject +# > 微博_屏蔽sdkconfig请求@ddgksf2013 +^https?:\/\/sdkapp\.uve\.weibo\.com\/interface\/sdk\/sdkconfig\.php url reject # > 微博_Spotlight@ddgksf2013 ^https?:\/\/m?api\.weibo\.c(n|om)\/\d\/hot\/hours_spotlight url reject-dict # > 微博_自定义tab皮肤@zmqcherish ^https://api.weibo.cn/2/!/client/light_skin url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js # > 微博_非会员设置tab皮肤@zmqcherish ^https://new.vip.weibo.cn/littleskin/preview url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js -# > 微博_去广告以及去除各部分推广模块@zmqcherish +# > 微博_去广告以及去除各部分推广模块@zmqcherish,@ddgksf2013 ^https?:\/\/m?api\.weibo\.c(n|om)\/\d\/(searchall|page\?|messageflow) url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js ^https?:\/\/m?api\.weibo\.c(n|om)\/\d\/statuses/(unread_)?friends(/|_)timeline url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js ^https?:\/\/m?api\.weibo\.c(n|om)\/\d\/groups/timeline url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js @@ -76,14 +90,10 @@ hostname = *api.weibo*, *uve.weibo.com, new.vip.weibo.cn ^https?:\/\/m?api\.weibo\.c(n|om)\/\d\/search/(finder|container_timeline|container_discover) url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js ^https?:\/\/m?api\.weibo\.c(n|om)\/\d\/(checkin/show|\!/live/media_homelist|comments/build_comments|container/get_item) url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js ^https?:\/\/m?api\.weibo\.c(n|om)\/\d\/cardlist url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.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 # > 微博国际版_屏蔽hotsearch@ddgksf2013 ^https?:\/\/weibointl\.api\.weibo\.c(n|om)\/portal\.php\?a=hot_search_users url reject-dict # > 微博国际版_屏蔽热推荐@ddgksf2013 ^https?:\/\/m?api\.weibo\.c(n|om)\/\d\/ad\/weibointl\? url reject-dict -# > 微博国际版_屏蔽search_suggest@ddgksf2013 -# ^https?:\/\/m?api\.weibo\.c(n|om)\/\d\/page\/get_search_suggest url reject-dict # > 微博国际版_屏蔽searching_info@ddgksf2013 ^https?:\/\/weibointl\.api\.weibo\.c(n|om)\/portal\.php.*user&a=get_searching_info url echo-response text/html echo-response https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_search_info.json # > 微博国际版_屏蔽search_topic@ddgksf2013 @@ -95,4 +105,6 @@ hostname = *api.weibo*, *uve.weibo.com, new.vip.weibo.cn # > 微博国际版_趋势顶部Card去广告@ddgksf2013 ^https?:\/\/weibointl\.api\.weibo\.c(n|om)\/portal\.php.*feed&a=trends url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js # > 微博国际版_屏蔽用户VIP栏@ddgksf2013 -^https?:\/\/weibointl\.api\.weibo\.cn\/portal\.php\?a=user_center url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js \ No newline at end of file +^https?:\/\/weibointl\.api\.weibo\.cn\/portal\.php\?a=user_center url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js +# > 微博国际版_热搜处理@ddgksf2013 +^https?:\/\/weibointl\.api\.weibo\.cn\/portal\.php\?a=search_topic url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js \ No newline at end of file diff --git a/Scripts/AdBlock/Weibo/weibo_json.js b/Scripts/AdBlock/Weibo/weibo_json.js index 0b494ab..c61573b 100644 --- a/Scripts/AdBlock/Weibo/weibo_json.js +++ b/Scripts/AdBlock/Weibo/weibo_json.js @@ -1,20 +1,17 @@ -/*********************************** - +/*********************************************** > 应用名称:墨鱼自用QX微博&微博国际版净化 > 脚本作者:@Zmqcherish, @Cuttlefish > 微信账号:墨鱼手记 -> 更新时间:2022-12-25 +> 更新时间:2022-01-09 > 通知频道:https://t.me/ddgksf2021 > 贡献投稿:https://t.me/ddgksf2013_bot > 原作者库:https://github.com/zmqcherish > 问题反馈:ddgksf2013@163.com > 特别提醒:如需转载请注明出处,谢谢合作! -> 脚本声明:特别感谢Zmqcherish的付出,本脚本只是在他原创脚本的基础上优化QX自用 -> 原创地址:https://github.com/zmqcherish/proxy-script/raw/main/weibo.conf - -***********************************/ +> 脚本声明:本脚本是在Zmqcherish原创基础上优化自用 +***********************************************/ -const version = "V2.0.65"; +const version = "V2.0.84"; const mainConfig = { isDebug: !1, @@ -32,7 +29,7 @@ const mainConfig = { removePinedTrending: !0, removeInterestFriendInTopic: !1, removeInterestTopic: !1, - removeInterestUser: !1, + removeInterestUser: !0, removeLvZhou: !0, removeSearchWindow: !0, profileSkin1: null, @@ -101,6 +98,7 @@ const mainConfig = { "ct=feed&a=trends": "removeTopics", user_center: "modifiedUserCenter", "a=get_coopen_ads": "removeIntlOpenAds", + "php?a=search_topic": "removeSearchTopic", }; function getModifyMethod(e) { for (let t of modifyCardsUrls) if (e.indexOf(t) > -1) return "removeCards"; @@ -126,6 +124,14 @@ function removeIntlOpenAds(e) { e ); } +function removeSearchTopic(e) { + return ( + e.data && + 0 !== e.data.length && + (e.data = Object.values(e.data).filter((e) => "searchtop" != e.type)), + e + ); +} function modifiedUserCenter(e) { return ( e.data && @@ -168,7 +174,10 @@ function removeMainTab(e) { ) return e; let t = []; - for (let o of e.items) isAd(o.data) || t.push(o); + for (let o of e.items) + isAd(o.data) || + (o.data?.common_struct && delete o.data.common_struct, + o.category ? "group" != o.category && t.push(o) : t.push(o)); return (e.items = t), log("removeMainTab success"), e; } function removeMain(e) { @@ -198,7 +207,11 @@ function removeMain(e) { o.items[0].data?.itemid?.includes("top_title") ) continue; - t.push(o); + o.items.length > 0 + ? (o.items = Object.values(o.items).filter( + (e) => "feed" == e.category + )) + : t.push(o); } } else -1 == [202, 200].indexOf(o.data.card_type) && t.push(o); return (e.items = t), log("removeMain success"), e; @@ -211,32 +224,32 @@ function topicHandler(e) { for (let i of t) { let n = !0; if (i.mblog) { - let r = i.mblog.buttons; - mainConfig.removeUnfollowTopic && r && "follow" == r[0].type && (n = !1); + let a = i.mblog.buttons; + mainConfig.removeUnfollowTopic && a && "follow" == a[0].type && (n = !1); } else { if (!mainConfig.removeUnusedPart) continue; if ("bottom_mix_activity" == i.itemid) n = !1; else if (i?.top?.title == "正在活跃") n = !1; else if (200 == i.card_type && i.group) n = !1; else { - let a = i.card_group; - if (!a) continue; + let r = i.card_group; + if (!r) continue; if ( [ "guess_like_title", "cats_top_title", "chaohua_home_readpost_samecity_title", - ].indexOf(a[0].itemid) > -1 + ].indexOf(r[0].itemid) > -1 ) n = !1; - else if (a.length > 1) { - let s = []; - for (let d of a) + else if (r.length > 1) { + let d = []; + for (let s of r) -1 == ["chaohua_discovery_banner_1", "bottom_mix_activity"].indexOf( - d.itemid - ) && s.push(d); - i.card_group = s; + s.itemid + ) && d.push(s); + i.card_group = d; } } } @@ -255,10 +268,10 @@ function checkSearchWindow(e) { return ( !!mainConfig.removeSearchWindow && "card" == e.category && - (e.data?.itemid == "hot_search_push" || - e.data?.itemid == "finder_window" || + (e.data?.itemid == "finder_window" || e.data?.itemid == "more_frame" || e.data?.card_type == 208 || + e.data?.card_type == 217 || e.data?.card_type == 19 || e.data?.mblog?.page_info?.actionlog?.source?.includes("ad")) ); @@ -307,19 +320,19 @@ function removePage(e) { ); } function removeCards(e) { - if (!e.cards) return; + if ((e.hotwords && (e.hotwords = []), !e.cards)) return; let t = []; for (let o of e.cards) { let i = o.card_group; if (i && i.length > 0) { let n = []; - for (let r of i) 118 != r.card_type && n.push(r); + for (let a of i) 118 != a.card_type && n.push(a); (o.card_group = n), t.push(o); } else { - let a = o.card_type; - if ([9, 165].indexOf(a) > -1) isAd(o.mblog) || t.push(o); + let r = o.card_type; + if ([9, 165].indexOf(r) > -1) isAd(o.mblog) || t.push(o); else { - if ([1007, 180].indexOf(a) > -1) continue; + if ([1007, 180].indexOf(r) > -1) continue; t.push(o); } } @@ -346,7 +359,10 @@ function removeTimeLine(e) { if (!e.statuses) return; let o = []; for (let i of e.statuses) - isAd(i) || (lvZhouHandler(i), isBlock(i) || o.push(i)); + isAd(i) || + (lvZhouHandler(i), + i.common_struct && delete i.common_struct, + i.category ? "group" != i.category && o.push(i) : o.push(i)); e.statuses = o; } function removeHomeVip(e) { @@ -384,13 +400,13 @@ function itemExtendHandler(e) { if (mainConfig.modifyMenus && e.custom_action_list) { let i = []; for (let n of e.custom_action_list) { - let r = n.type, - a = itemMenusConfig[r]; - void 0 === a + let a = n.type, + r = itemMenusConfig[a]; + void 0 === r ? i.push(n) - : "mblog_menus_copy_url" === r + : "mblog_menus_copy_url" === a ? i.unshift(n) - : a && i.push(n); + : r && i.push(n); } e.custom_action_list = i; } @@ -423,9 +439,9 @@ function updateProfileSkin(e, t) { "alpha" != dm && (n.image.style.darkMode = "alpha"), (n.image.iconUrl = o[i++]), n.dot && (n.dot = []); - } catch (r) {} + } catch (a) {} log("updateProfileSkin success"); - } catch (a) { + } catch (r) { console.log("updateProfileSkin fail"); } } @@ -436,6 +452,7 @@ function removeHome(e) { let i = o.itemId; if ("profileme_mine" == i) mainConfig.removeHomeVip && (o = removeHomeVip(o)), + o.header?.vipIcon && delete o.header.vipIcon, updateFollowOrder(o), t.push(o); else if ("100505_-_top8" == i) @@ -478,8 +495,8 @@ function removeComments(e) { if (0 === o.length) return; let i = []; for (let n of o) { - let r = n.adType || ""; - -1 == t.indexOf(r) && 6 != n.type && i.push(n); + let a = n.adType || ""; + -1 == t.indexOf(a) && 6 != n.type && i.push(n); } log("remove 评论区相关和推荐内容"), (e.datas = i); } @@ -495,7 +512,7 @@ function containerHandler(e) { (log("remove 超话好友关注"), (e.card_group = []))); } function userHandler(e) { - if (((e = removeMain(e)), !mainConfig.removeInterestUser || !e.items)) + if (((e = removeMainTab(e)), !mainConfig.removeInterestUser || !e.items)) return e; let t = []; for (let o of e.items) { @@ -504,7 +521,7 @@ function userHandler(e) { try { "可能感兴趣的人" == o.items[0].data.desc && (i = !1); } catch (n) {} - i && t.push(o); + i && (o.data?.common_struct && delete o.data.common_struct, t.push(o)); } return (e.items = t), log("removeMain sub success"), e; } @@ -540,15 +557,16 @@ function removeLuaScreenAds(e) { function removePhpScreenAds(e) { if (!e.ads) return e; for (let t of ((e.show_push_splash_ad = !1), - (e.background_delay_display_time = 86400), - (e.lastAdShow_delay_display_time = 604800), - (e.realtime_ad_video_stall_time = 86400), - (e.realtime_ad_timeout_duration = 604800), + (e.background_delay_display_time = 0), + (e.lastAdShow_delay_display_time = 0), + (e.realtime_ad_video_stall_time = 0), + (e.realtime_ad_timeout_duration = 0), e.ads)) (t.displaytime = 0), (t.displayintervel = 86400), (t.allowdaydisplaynum = 0), (t.displaynum = 0), + (t.displaytime = 1), (t.begintime = "2029-12-30 00:00:00"), (t.endtime = "2029-12-30 23:59:59"); return e;