feat: 🧣 优化微博相关

This commit is contained in:
sve1r 2023-03-02 17:11:53 +08:00
parent 5187bdc9b9
commit 2bade4ce90
3 changed files with 60 additions and 45 deletions

View File

@ -1,16 +1,27 @@
// ==UserScript==
// @UpdateTime 2023-02-15
// @ScriptName 微博&微博国际版净化[墨鱼版]
// @Author @ddgksf2013,@zmqcherish
// @ForHelp 若有屏蔽广告的需求可公众号后台回复APP名称
// @WechatID 公众号墨鱼手记
// @TgChannel https://t.me/ddgksf2021
// @Contribute https://t.me/ddgksf2013_bot
// @Feedback 📮 ddgksf2013@163.com 📮
// @UpdateTime 2023-02-25
// @Attention 微博、微博国际版净化,现已二合一,使用中若有问题请发邮件!
// @Version V2.0.62
// @Function 让你更加愉悦的刷微博
// @Suitable 自行观看“# > ”注释内容
// @Attention 如需引用请注明出处,谢谢合作!
// @Version V2.0.67
// @ScriptURL https://github.com/ddgksf2013/Rewrite/raw/master/AdBlock/Weibo.conf
// ==/UserScript==
hostname = *api.weibo*, *uve.weibo.com, new.vip.weibo.cn
hostname = api.weibo.*, *.api.weibo.*, mapi.weibo.*, *.uve.weibo.com, new.vip.weibo.cn, boot.biz.weibo.com
# > 微博_请手动添加以下分流至本地@ddgksf2013
; host, sdkapp.uve.weibo.com, direct
# > 微博_每日一次的开屏广告请求@ddgksf2013
^https?:\/\/boot\.biz\.weibo\.com\/v1\/ad\/realtime url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js
# > 微博_视频信息处理@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_json.js
# > 微博_去除底部超话栏表层浮icon及tips@ddgksf2013

View File

@ -6,12 +6,12 @@
// @TgChannel https://t.me/ddgksf2021
// @Contribute https://t.me/ddgksf2013_bot
// @Feedback 📮 ddgksf2013@163.com 📮
// @UpdateTime 2023-02-15
// @UpdateTime 2023-02-25
// @Attention 微博、微博国际版净化,现已二合一,使用中若有问题请发邮件!
// @Function 让你更加愉悦的刷微博
// @Suitable 自行观看“# > ”注释内容
// @Attention 如需引用请注明出处,谢谢合作!
// @Version V2.0.62
// @Version V2.0.67
// @ScriptURL https://github.com/ddgksf2013/Rewrite/raw/master/AdBlock/Weibo.conf
// ==/UserScript==
@ -71,15 +71,23 @@
# [+]2023-02-09 52、自动删除我的页面除[超话社区]CARD以外的所有推广内容再也不用手动移除另外[超话社区]依然支持自主移除或添加到我的页面内
# [+]2023-02-09 53、我的页面Card白名单新增[我的最近访问],以方便群友,依然支持自主移除或添加
# [+]2023-02-13 54、修复某些用户微博页面最近动态不显示的bug增加微博视频detail处理
# [+]2023-02-15 55、在有缓存的情况下移除微博搜索框下的猜你想搜栏目以及猜你想搜偏好设置栏目
# [+]2023-02-15 55、在有缓存的情况下处理微博搜索框下的猜你想搜栏目以及猜你想搜偏好设置栏目[code not added]
# [+]2023-02-16 56、处理部分用户每日首次打开微博的开屏广告请求[部分用户是指未将boot.biz.weibo.com域名添加黑名单]
# [+]2023-02-18 57、修复微博在繁体字下评论区屏蔽用户推荐失效的问题
# [+]2023-02-22 58、处理信息流中视频左上角的"红包派送中"Tag[code not added]
# [+]2023-02-25 59、处理用户反馈的微博国际版微博会员推广CARD
# [+]2023-02-25 60、修改MITM写法使小火箭工具能够MITM本重写的域名[后续新的重写配置也将注意此问题]
hostname = *api.weibo*, *uve.weibo.com, new.vip.weibo.cn
hostname = api.weibo.*, *.api.weibo.*, mapi.weibo.*, *.uve.weibo.com, new.vip.weibo.cn, boot.biz.weibo.com
# > 微博_请手动添加以下分流至本地@ddgksf2013
; host, sdkapp.uve.weibo.com, direct
# > 微博_每日一次的开屏广告请求@ddgksf2013
^https?:\/\/boot\.biz\.weibo\.com\/v1\/ad\/realtime url script-response-body https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/AdBlock/Weibo/weibo_json.js
# > 微博_视频信息处理@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_json.js
# > 微博_去除底部超话栏表层浮icon及tips@ddgksf2013

View File

@ -2,7 +2,7 @@
> 应用名称墨鱼自用微博&微博国际版净化脚本
> 脚本作者@ddgksf2013, @Zmqcherish
> 微信账号墨鱼手记
> 更新时间2022-02-13
> 更新时间2022-02-25
> 通知频道https://t.me/ddgksf2021
> 贡献投稿https://t.me/ddgksf2013_bot
> 原作者库https://github.com/zmqcherish
@ -12,7 +12,7 @@
> 脚本声明若有侵犯原作者权利请邮箱联系删除
***********************************************/
const version = "V2.0.98";
const version = "V2.0.101";
const mainConfig = {
isDebug: !1,
@ -102,7 +102,7 @@ const mainConfig = {
user_center: "modifiedUserCenter",
"a=get_coopen_ads": "removeIntlOpenAds",
"php?a=search_topic": "removeSearchTopic",
"v2/strategy/ad": "removeStrategyAd",
"v1/ad/realtime": "removeRealtimeAd",
};
function getModifyMethod(e) {
for (let t of modifyCardsUrls) if (e.indexOf(t) > -1) return "removeCards";
@ -111,6 +111,9 @@ function getModifyMethod(e) {
for (let [i, r] of Object.entries(otherUrls)) if (e.indexOf(i) > -1) return r;
return null;
}
function removeRealtimeAd(e) {
return delete e.ads, (e.code = 4016), e;
}
function removeIntlOpenAds(e) {
return (
e.data &&
@ -148,12 +151,7 @@ function modifiedUserCenter(e) {
);
}
function removeTopics(e) {
return (
e.data &&
(e.data.topics && delete e.data.topics,
e.data.discover && delete e.data.discover),
e
);
return e.data && (e.data.order = ["search_topic", "native_content"]), e;
}
function isAd(e) {
return (
@ -229,27 +227,27 @@ function topicHandler(e) {
for (let i of t) {
let r = !0;
if (i.mblog) {
let a = i.mblog.buttons;
mainConfig.removeUnfollowTopic && a && "follow" == a[0].type && (r = !1);
let n = i.mblog.buttons;
mainConfig.removeUnfollowTopic && n && "follow" == n[0].type && (r = !1);
} else {
if (!mainConfig.removeUnusedPart) continue;
if ("bottom_mix_activity" == i.itemid) r = !1;
else if (i?.top?.title == "正在活跃") r = !1;
else if (200 == i.card_type && i.group) r = !1;
else {
let n = i.card_group;
if (!n) continue;
let a = i.card_group;
if (!a) continue;
if (
[
"guess_like_title",
"cats_top_title",
"chaohua_home_readpost_samecity_title",
].indexOf(n[0].itemid) > -1
].indexOf(a[0].itemid) > -1
)
r = !1;
else if (n.length > 1) {
else if (a.length > 1) {
let d = [];
for (let s of n)
for (let s of a)
-1 ==
["chaohua_discovery_banner_1", "bottom_mix_activity"].indexOf(
s.itemid
@ -333,17 +331,17 @@ function removeCards(e) {
let i = o.card_group;
if (i && i.length > 0) {
let r = [];
for (let a of i)
118 == a.card_type ||
isAd(a.mblog) ||
-1 != JSON.stringify(a).indexOf("res_from:ads") ||
r.push(a);
for (let n of i)
118 == n.card_type ||
isAd(n.mblog) ||
-1 != JSON.stringify(n).indexOf("res_from:ads") ||
r.push(n);
(o.card_group = r), t.push(o);
} else {
let n = o.card_type;
if ([9, 165].indexOf(n) > -1) isAd(o.mblog) || t.push(o);
let a = o.card_type;
if ([9, 165].indexOf(a) > -1) isAd(o.mblog) || t.push(o);
else {
if ([1007, 180].indexOf(n) > -1) continue;
if ([1007, 180].indexOf(a) > -1) continue;
t.push(o);
}
}
@ -411,13 +409,13 @@ function itemExtendHandler(e) {
if (mainConfig.modifyMenus && e.custom_action_list) {
let i = [];
for (let r of e.custom_action_list) {
let a = r.type,
n = itemMenusConfig[a];
void 0 === n
let n = r.type,
a = itemMenusConfig[n];
void 0 === a
? i.push(r)
: "mblog_menus_copy_url" === a
: "mblog_menus_copy_url" === n
? i.unshift(r)
: n && i.push(r);
: a && i.push(r);
}
e.custom_action_list = i;
}
@ -450,9 +448,9 @@ function updateProfileSkin(e, t) {
"alpha" != dm && (r.image.style.darkMode = "alpha"),
(r.image.iconUrl = o[i++]),
r.dot && (r.dot = []);
} catch (a) {}
} catch (n) {}
log("updateProfileSkin success");
} catch (n) {
} catch (a) {
console.log("updateProfileSkin fail");
}
}
@ -497,15 +495,13 @@ function removeMediaHomelist(e) {
mainConfig.removeLiveMedia && (log("remove 首页直播"), (e.data = {}));
}
function removeComments(e) {
let t = ["广告", "廣告"];
mainConfig.removeRelateItem && t.push(...["相关内容"]),
mainConfig.removeRecommendItem && t.push(...["推荐", "热推"]);
let o = e.datas || [];
let t = ["广告", "廣告", "相关内容", "推荐", "热推", "推薦"],
o = e.datas || [];
if (0 === o.length) return;
let i = [];
for (let r of o) {
let a = r.adType || "";
-1 == t.indexOf(a) && 6 != r.type && i.push(r);
let n = r.adType || "";
-1 == t.indexOf(n) && 6 != r.type && i.push(r);
}
log("remove 评论区相关和推荐内容"), (e.datas = i);
}