🧣 feat: 优化微博相关内容

This commit is contained in:
sve1r 2023-04-12 14:53:16 +08:00
parent 8d246e67fe
commit d4cffab6f8
6 changed files with 98 additions and 657 deletions

View File

@ -6,25 +6,21 @@
// @TgChannel https://t.me/ddgksf2021 // @TgChannel https://t.me/ddgksf2021
// @Contribute https://t.me/ddgksf2013_bot // @Contribute https://t.me/ddgksf2013_bot
// @Feedback 📮 ddgksf2013@163.com 📮 // @Feedback 📮 ddgksf2013@163.com 📮
// @UpdateTime 2023-03-04 // @UpdateTime 2023-04-11
// @Attention 微博、微博国际版净化,现已二合一,使用中若有问题请发邮件! // @Attention 微博、微博国际版净化,现已二合一,使用中若有问题请发邮件!
// @Function 让你更加愉悦的刷微博 // @Function 让你更加愉悦的刷微博
// @Suitable 自行观看“# > ”注释内容 // @Suitable 自行观看“# > ”注释内容
// @Attention 如需引用请注明出处,谢谢合作! // @Attention 如需引用请注明出处,谢谢合作!
// @Version V2.0.71 // @Version V2.0.77
// @ScriptURL https://github.com/ddgksf2013/Rewrite/raw/master/AdBlock/Weibo.conf // @ScriptURL https://github.com/ddgksf2013/Rewrite/raw/master/AdBlock/Weibo.conf
// ==/UserScript== // ==/UserScript==
hostname = api.weibo.*, *.api.weibo.*, mapi.weibo.*, *.uve.weibo.com, new.vip.weibo.cn, boot.biz.weibo.com hostname = api.weibo.*, *.api.weibo.*, mapi.weibo.*, *.uve.weibo.com, new.vip.weibo.cn, boot.biz.weibo.com
# > 微博_请手动添加以下分流至本地@ddgksf2013 # > 微博_未登陆状态下首页信息流处理@ddgksf2013
; host, sdkapp.uve.weibo.com, direct ^https?:\/\/api\.weibo\.cn\/\d\/\w{5}\/(statuses_unread_hot_timeline|timeline) url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo.min.js
; host, boot.biz.weibo.com, reject
# > 微博_每日一次的开屏广告请求@ddgksf2013 # > 微博_每日一次的开屏广告请求@ddgksf2013
^https?:\/\/boot\.biz\.weibo\.com\/v1\/ad\/realtime url reject-200 ^https?:\/\/boot.*weibo\.com\/v\d\/ad\/realtime url reject-200
# > 微博_视频信息处理@ddgksf2013 # > 微博_视频信息处理@ddgksf2013
^https?:\/\/api\.weibo\.cn\/\d\/video\/tiny_stream_mid_detail url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo.min.js ^https?:\/\/api\.weibo\.cn\/\d\/video\/tiny_stream_mid_detail url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo.min.js
# > 微博_去除底部超话栏表层浮icon及tips@ddgksf2013 # > 微博_去除底部超话栏表层浮icon及tips@ddgksf2013

View File

@ -6,12 +6,12 @@
// @TgChannel https://t.me/ddgksf2021 // @TgChannel https://t.me/ddgksf2021
// @Contribute https://t.me/ddgksf2013_bot // @Contribute https://t.me/ddgksf2013_bot
// @Feedback 📮 ddgksf2013@163.com 📮 // @Feedback 📮 ddgksf2013@163.com 📮
// @UpdateTime 2023-03-04 // @UpdateTime 2023-04-11
// @Attention 微博、微博国际版净化,现已二合一,使用中若有问题请发邮件! // @Attention 微博、微博国际版净化,现已二合一,使用中若有问题请发邮件!
// @Function 让你更加愉悦的刷微博 // @Function 让你更加愉悦的刷微博
// @Suitable 自行观看“# > ”注释内容 // @Suitable 自行观看“# > ”注释内容
// @Attention 如需引用请注明出处,谢谢合作! // @Attention 如需引用请注明出处,谢谢合作!
// @Version V2.0.71 // @Version V2.0.77
// @ScriptURL https://github.com/ddgksf2013/Rewrite/raw/master/AdBlock/Weibo.conf // @ScriptURL https://github.com/ddgksf2013/Rewrite/raw/master/AdBlock/Weibo.conf
// ==/UserScript== // ==/UserScript==
@ -78,17 +78,23 @@
# [+]2023-02-25 59、处理用户反馈的微博国际版微博会员推广CARD # [+]2023-02-25 59、处理用户反馈的微博国际版微博会员推广CARD
# [+]2023-02-25 60、修改MITM写法使小火箭工具能够MITM本重写的域名[后续新的重写配置也将注意此问题] # [+]2023-02-25 60、修改MITM写法使小火箭工具能够MITM本重写的域名[后续新的重写配置也将注意此问题]
# [+]2023-03-04 61、调整boot.biz.weibo.com屏蔽策略缩短微博应用启动时间提高用户使用体验[或在本地添加分流host,boot.biz.weibo.com,reject(Anti已包含)] # [+]2023-03-04 61、调整boot.biz.weibo.com屏蔽策略缩短微博应用启动时间提高用户使用体验[或在本地添加分流host,boot.biz.weibo.com,reject(Anti已包含)]
# [+]2023-03-09 62、微博在未登录状态下新增对首页[关注]与[热门]信息流广告的处理
# [+]2023-03-31 63、修复微博开屏广告屏蔽失效的bug
# [+]2023-04-02 64、去除微博超话[广场]tab页面顶部广告推送以及搜索框下方的“我的热搜”内容
# [+]2023-04-11 65、移除视频20s预览的限制
hostname = api.weibo.*, *.api.weibo.*, mapi.weibo.*, *.uve.weibo.com, new.vip.weibo.cn, boot.biz.weibo.com hostname = api.weibo.*, *.api.weibo.*, mapi.weibo.*, *.uve.weibo.com, new.vip.weibo.cn, boot.biz.weibo.com
# > 微博_请手动添加以下分流至本地@ddgksf2013 # > 微博_请手动添加以下分流至本地@ddgksf2013
; host, sdkapp.uve.weibo.com, direct ; host, sdkapp.uve.weibo.com, direct
; host, boot.biz.weibo.com, reject
# > 微博_未登陆状态下首页信息流处理@ddgksf2013
^https?:\/\/api\.weibo\.cn\/\d\/\w{5}\/(statuses_unread_hot_timeline|timeline) url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo.min.js
# > 微博_每日一次的开屏广告请求@ddgksf2013 # > 微博_每日一次的开屏广告请求@ddgksf2013
^https?:\/\/boot\.biz\.weibo\.com\/v1\/ad\/realtime url reject-200 ^https?:\/\/boot.*weibo\.com\/v\d\/ad\/realtime url reject-200
# > 微博_视频信息处理@ddgksf2013 # > 微博_视频信息处理@ddgksf2013
^https?:\/\/api\.weibo\.cn\/\d\/video\/tiny_stream_mid_detail url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo.min.js ^https?:\/\/api\.weibo\.cn\/\d\/video\/tiny_stream_mid_detail url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo.min.js
# > 微博_去除底部超话栏表层浮icon及tips@ddgksf2013 # > 微博_去除底部超话栏表层浮icon及tips@ddgksf2013

View File

@ -17,6 +17,7 @@ host-suffix,weibocdn.com,Weibo
# > Weibo Client & SDK # > Weibo Client & SDK
host-suffix,wbapp.mobile.sina.cn,reject host-suffix,wbapp.mobile.sina.cn,reject
host-suffix,sdkapp.mobile.sina.cn,reject host-suffix,sdkapp.mobile.sina.cn,reject
host,sdkapp.uve.weibo.com, direct
# > Weibo Img # > Weibo Img
host-suffix,sinajs.cn,Weibo host-suffix,sinajs.cn,Weibo

View File

@ -2,7 +2,7 @@
> 应用名称墨鱼自用微博&微博国际版净化脚本 > 应用名称墨鱼自用微博&微博国际版净化脚本
> 脚本作者@ddgksf2013, @Zmqcherish > 脚本作者@ddgksf2013, @Zmqcherish
> 微信账号墨鱼手记 > 微信账号墨鱼手记
> 更新时间2022-02-25 > 更新时间2022-04-11
> 通知频道https://t.me/ddgksf2021 > 通知频道https://t.me/ddgksf2021
> 贡献投稿https://t.me/ddgksf2013_bot > 贡献投稿https://t.me/ddgksf2013_bot
> 原作者库https://github.com/zmqcherish > 原作者库https://github.com/zmqcherish
@ -12,7 +12,7 @@
> 脚本声明若有侵犯原作者权利请邮箱联系删除 > 脚本声明若有侵犯原作者权利请邮箱联系删除
***********************************************/ ***********************************************/
const version = "V2.0.101"; const version = "V2.0.107";
const mainConfig = { const mainConfig = {
isDebug: !1, isDebug: !1,
@ -68,6 +68,7 @@ const mainConfig = {
modifyCardsUrls = ["/cardlist", "video/community_tab", "/searchall"], modifyCardsUrls = ["/cardlist", "video/community_tab", "/searchall"],
modifyStatusesUrls = [ modifyStatusesUrls = [
"statuses/friends/timeline", "statuses/friends/timeline",
"statuses_unread_hot_timeline",
"statuses/unread_friends_timeline", "statuses/unread_friends_timeline",
"statuses/unread_hot_timeline", "statuses/unread_hot_timeline",
"groups/timeline", "groups/timeline",
@ -93,7 +94,7 @@ const mainConfig = {
"/2/messageflow": "removeMsgAd", "/2/messageflow": "removeMsgAd",
"/2/page?": "removePage", "/2/page?": "removePage",
"/statuses/unread_topic_timeline": "topicHandler", "/statuses/unread_topic_timeline": "topicHandler",
"square&pageDataType": "squareHandler", "/square&pageDataType/": "squareHandler",
"/statuses/container_timeline_topic": "removeMain", "/statuses/container_timeline_topic": "removeMain",
"/statuses/container_timeline": "removeMainTab", "/statuses/container_timeline": "removeMainTab",
"wbapplua/wbpullad.lua": "removeLuaScreenAds", "wbapplua/wbpullad.lua": "removeLuaScreenAds",
@ -108,7 +109,7 @@ function getModifyMethod(e) {
for (let t of modifyCardsUrls) if (e.indexOf(t) > -1) return "removeCards"; for (let t of modifyCardsUrls) if (e.indexOf(t) > -1) return "removeCards";
for (let o of modifyStatusesUrls) for (let o of modifyStatusesUrls)
if (e.indexOf(o) > -1) return "removeTimeLine"; if (e.indexOf(o) > -1) return "removeTimeLine";
for (let [i, r] of Object.entries(otherUrls)) if (e.indexOf(i) > -1) return r; for (let [i, a] of Object.entries(otherUrls)) if (e.indexOf(i) > -1) return a;
return null; return null;
} }
function removeRealtimeAd(e) { function removeRealtimeAd(e) {
@ -200,7 +201,8 @@ function removeMain(e) {
(o.items = o.items.filter( (o.items = o.items.filter(
(e) => (e) =>
e?.data?.itemid?.includes("mine_topics") || e?.data?.itemid?.includes("mine_topics") ||
e?.data?.itemid?.includes("search_input") e?.data?.itemid?.includes("search_input") ||
e?.data?.card_type == 202
)), )),
(o.items[0].data.hotwords = [{ word: "搜索超话", tip: "" }]), (o.items[0].data.hotwords = [{ word: "搜索超话", tip: "" }]),
t.push(o); t.push(o);
@ -210,11 +212,11 @@ function removeMain(e) {
o.items[0].data?.itemid?.includes("top_title") o.items[0].data?.itemid?.includes("top_title")
) )
continue; continue;
o.items.length > 0 o.items.length > 0 &&
? (o.items = Object.values(o.items).filter( (o.items = Object.values(o.items).filter(
(e) => "feed" == e.category (e) => "feed" == e.category || "card" == e.category
)) )),
: t.push(o); t.push(o);
} }
} else -1 == [202, 200].indexOf(o.data.card_type) && t.push(o); } else -1 == [202, 200].indexOf(o.data.card_type) && t.push(o);
return (e.items = t), log("removeMain success"), e; return (e.items = t), log("removeMain success"), e;
@ -225,29 +227,29 @@ function topicHandler(e) {
return e; return e;
let o = []; let o = [];
for (let i of t) { for (let i of t) {
let r = !0; let a = !0;
if (i.mblog) { if (i.mblog) {
let n = i.mblog.buttons; let r = i.mblog.buttons;
mainConfig.removeUnfollowTopic && n && "follow" == n[0].type && (r = !1); mainConfig.removeUnfollowTopic && r && "follow" == r[0].type && (a = !1);
} else { } else {
if (!mainConfig.removeUnusedPart) continue; if (!mainConfig.removeUnusedPart) continue;
if ("bottom_mix_activity" == i.itemid) r = !1; if ("bottom_mix_activity" == i.itemid) a = !1;
else if (i?.top?.title == "正在活跃") r = !1; else if (i?.top?.title == "正在活跃") a = !1;
else if (200 == i.card_type && i.group) r = !1; else if (200 == i.card_type && i.group) a = !1;
else { else {
let a = i.card_group; let n = i.card_group;
if (!a) continue; if (!n) continue;
if ( if (
[ [
"guess_like_title", "guess_like_title",
"cats_top_title", "cats_top_title",
"chaohua_home_readpost_samecity_title", "chaohua_home_readpost_samecity_title",
].indexOf(a[0].itemid) > -1 ].indexOf(n[0].itemid) > -1
) )
r = !1; a = !1;
else if (a.length > 1) { else if (n.length > 1) {
let d = []; let d = [];
for (let s of a) for (let s of n)
-1 == -1 ==
["chaohua_discovery_banner_1", "bottom_mix_activity"].indexOf( ["chaohua_discovery_banner_1", "bottom_mix_activity"].indexOf(
s.itemid s.itemid
@ -256,7 +258,7 @@ function topicHandler(e) {
} }
} }
} }
r && o.push(i); a && o.push(i);
} }
return (e.cards = o), log("topicHandler success"), e; return (e.cards = o), log("topicHandler success"), e;
} }
@ -284,7 +286,10 @@ function removeSearch(e) {
if (!e.items) return e; if (!e.items) return e;
let t = []; let t = [];
for (let o of e.items) for (let o of e.items)
if ("feed" == o.category) isAd(o.data) || t.push(o); if ("feed" == o.category)
isAd(o.data) ||
(o.data?.page_info?.video_limit && delete o.data.page_info.video_limit,
t.push(o));
else { else {
if ("group" == o.category) continue; if ("group" == o.category) continue;
checkSearchWindow(o) || t.push(o); checkSearchWindow(o) || t.push(o);
@ -327,21 +332,25 @@ function removeCards(e) {
if ((e.hotwords && (e.hotwords = []), !e.cards)) return; if ((e.hotwords && (e.hotwords = []), !e.cards)) return;
let t = []; let t = [];
for (let o of e.cards) { for (let o of e.cards) {
if (17 == o.card_type || 58 == o.card_type) continue; if (
e.cardlistInfo?.page_type == "08" &&
(17 == o.card_type || 58 == o.card_type || 11 == o.card_type)
)
continue;
let i = o.card_group; let i = o.card_group;
if (i && i.length > 0) { if (i && i.length > 0) {
let r = []; let a = [];
for (let n of i) for (let r of i)
118 == n.card_type || 118 == r.card_type ||
isAd(n.mblog) || isAd(r.mblog) ||
-1 != JSON.stringify(n).indexOf("res_from:ads") || -1 != JSON.stringify(r).indexOf("res_from:ads") ||
r.push(n); a.push(r);
(o.card_group = r), t.push(o); (o.card_group = a), t.push(o);
} else { } else {
let a = o.card_type; let n = o.card_type;
if ([9, 165].indexOf(a) > -1) isAd(o.mblog) || t.push(o); if ([9, 165].indexOf(n) > -1) isAd(o.mblog) || t.push(o);
else { else {
if ([1007, 180].indexOf(a) > -1) continue; if ([1007, 180].indexOf(n) > -1) continue;
t.push(o); t.push(o);
} }
} }
@ -408,14 +417,14 @@ function itemExtendHandler(e) {
} catch (o) {} } catch (o) {}
if (mainConfig.modifyMenus && e.custom_action_list) { if (mainConfig.modifyMenus && e.custom_action_list) {
let i = []; let i = [];
for (let r of e.custom_action_list) { for (let a of e.custom_action_list) {
let n = r.type, let r = a.type,
a = itemMenusConfig[n]; n = itemMenusConfig[r];
void 0 === a void 0 === n
? i.push(r) ? i.push(a)
: "mblog_menus_copy_url" === n : "mblog_menus_copy_url" === r
? i.unshift(r) ? i.unshift(a)
: a && i.push(r); : n && i.push(a);
} }
e.custom_action_list = i; e.custom_action_list = i;
} }
@ -441,16 +450,16 @@ function updateProfileSkin(e, t) {
let o = mainConfig[t]; let o = mainConfig[t];
if (!o) return; if (!o) return;
let i = 0; let i = 0;
for (let r of e.items) for (let a of e.items)
if (r.image) if (a.image)
try { try {
(dm = r.image.style.darkMode), (dm = a.image.style.darkMode),
"alpha" != dm && (r.image.style.darkMode = "alpha"), "alpha" != dm && (a.image.style.darkMode = "alpha"),
(r.image.iconUrl = o[i++]), (a.image.iconUrl = o[i++]),
r.dot && (r.dot = []); a.dot && (a.dot = []);
} catch (n) {} } catch (r) {}
log("updateProfileSkin success"); log("updateProfileSkin success");
} catch (a) { } catch (n) {
console.log("updateProfileSkin fail"); console.log("updateProfileSkin fail");
} }
} }
@ -499,9 +508,9 @@ function removeComments(e) {
o = e.datas || []; o = e.datas || [];
if (0 === o.length) return; if (0 === o.length) return;
let i = []; let i = [];
for (let r of o) { for (let a of o) {
let n = r.adType || ""; let r = a.adType || "";
-1 == t.indexOf(n) && 6 != r.type && i.push(r); -1 == t.indexOf(r) && 6 != a.type && i.push(a);
} }
log("remove 评论区相关和推荐内容"), (e.datas = i); log("remove 评论区相关和推荐内容"), (e.datas = i);
} }
@ -525,7 +534,7 @@ function userHandler(e) {
if ("group" == o.category) if ("group" == o.category)
try { try {
"可能感兴趣的人" == o.items[0].data.desc && (i = !1); "可能感兴趣的人" == o.items[0].data.desc && (i = !1);
} catch (r) {} } catch (a) {}
i && (o.data?.common_struct && delete o.data.common_struct, 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; return (e.items = t), log("removeMain sub success"), e;
@ -536,7 +545,7 @@ function nextVideoHandler(e) {
for (let o of e.statuses) for (let o of e.statuses)
if (!isAd(o)) { if (!isAd(o)) {
let i = ["forward_redpacket_info", "shopping", "float_info", "tags"]; let i = ["forward_redpacket_info", "shopping", "float_info", "tags"];
for (let r of i) o.video_info?.[r] && delete o.video_info[r]; for (let a of i) o.video_info?.[a] && delete o.video_info[a];
t.push(o); t.push(o);
} }
return (e.statuses = t), log("removeMainTab Success"), e; return (e.statuses = t), log("removeMainTab Success"), e;
@ -548,7 +557,7 @@ function tabSkinHandler(e) {
let o = e.data.list; let o = e.data.list;
for (let i of o) (i.version = t), (i.downloadlink = mainConfig.tabIconPath); for (let i of o) (i.version = t), (i.downloadlink = mainConfig.tabIconPath);
log("tabSkinHandler success"); log("tabSkinHandler success");
} catch (r) { } catch (a) {
log("tabSkinHandler fail"); log("tabSkinHandler fail");
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long