mirror of
https://github.com/fmz200/wool_scripts.git
synced 2025-12-24 14:14:58 +08:00
Initial commit: new history
This commit is contained in:
296
Scripts/weibo/weibo_ads.js
Normal file
296
Scripts/weibo/weibo_ads.js
Normal file
@ -0,0 +1,296 @@
|
||||
/**
|
||||
* @author fmz200
|
||||
* @function 微博去广告
|
||||
* @date 2025-06-29 23:00:00
|
||||
*/
|
||||
|
||||
let url = $request.url;
|
||||
let body = $response.body;
|
||||
let resp_data = JSON.parse(body);
|
||||
|
||||
try {
|
||||
// 1、首次点击发现按钮
|
||||
if (url.includes("/search/finder?")) {
|
||||
console.log('进入发现页...');
|
||||
processPayload(resp_data.channelInfo.channels[0].payload);
|
||||
removeChannelsTabs(resp_data.channelInfo.channels);
|
||||
if (resp_data.header?.data?.items) {
|
||||
removeHeaderAds(resp_data.header.data.items);
|
||||
}
|
||||
}
|
||||
|
||||
// 2、发现页面刷新/再次点击发现按钮
|
||||
if (url.includes("/search/container_timeline?") || url.includes("/search/container_discover?")) {
|
||||
console.log('刷新发现页...');
|
||||
processPayload(resp_data);
|
||||
if (resp_data.header?.data?.items) {
|
||||
removeHeaderAds(resp_data.header.data.items);
|
||||
}
|
||||
}
|
||||
|
||||
// 3、微博热搜页面刷新
|
||||
if (url.includes("/2/page?") && resp_data.cards && resp_data.cards[0].card_group) {
|
||||
resp_data.cards[0].card_group = resp_data.cards[0].card_group.filter(group => group.promotion == null);
|
||||
console.log('处理微博热搜页面广告结束💕💕');
|
||||
}
|
||||
|
||||
// 微博热搜页面 “热搜”tab页
|
||||
if (url.includes("/2/flowpage?")) {
|
||||
// 删掉Banner图
|
||||
resp_data.pageHeader = {};
|
||||
for (let subItem of resp_data.items) {
|
||||
if (subItem.itemId === "hotword") {
|
||||
subItem.items = subItem.items.filter(group => group.data.promotion == null && !group.data.itemid.includes("c_type:51"));
|
||||
break;
|
||||
} else if (subItem.items) {
|
||||
subItem.items = subItem.items.filter(group => group.data.promotion == null && !group.data.itemid.includes("c_type:51"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4、微博超话页面
|
||||
if (url.includes("/statuses/container_timeline_topicpage?") && resp_data.items) {
|
||||
resp_data.items = resp_data.items.filter(item => !item.data || item.data.mblogtypename !== "广告");
|
||||
console.log('处理微博超话页面广告结束💕💕');
|
||||
}
|
||||
|
||||
// 5、微博详情页面
|
||||
if (url.includes("/statuses/extend?")) {
|
||||
delete resp_data.head_cards;
|
||||
delete resp_data.top_cards;
|
||||
delete resp_data.extend_info;
|
||||
delete resp_data.trend; // 博主好物种草
|
||||
delete resp_data.semantic_brand_params;
|
||||
delete resp_data.ad_tag_nature;
|
||||
delete resp_data.title_source;
|
||||
delete resp_data.reward_info;
|
||||
console.log('处理微博详情页面广告结束💕💕');
|
||||
}
|
||||
if (url.includes("/statuses/container_detail?")) {
|
||||
resp_data.pageHeader.data.items = resp_data.pageHeader.data.items.filter(item =>
|
||||
item?.category !== 'card' && item?.type !== 'share'
|
||||
);
|
||||
}
|
||||
|
||||
// 6、移除微博首页的多余tab页 微博首页Tab标签页
|
||||
if (url.includes("/groups/allgroups/v2")) {
|
||||
removePageDataAds(resp_data.pageDatas);
|
||||
// 删除恶心人的“全部微博”
|
||||
delete resp_data.pageDatas[0].categories[0].pageDatas[0];
|
||||
}
|
||||
|
||||
// 7、话题页面 微博话题页面
|
||||
if (url.includes("/2/searchall?")) {
|
||||
for (let i = 0; i < resp_data.items.length; i++) {
|
||||
if (resp_data.items[i].data?.mblogtypename === "广告" || resp_data.items[i].data?.ad_state === 1) {
|
||||
console.log('处理话题页面广告');
|
||||
resp_data.items[i] = {};
|
||||
continue;
|
||||
} else {
|
||||
deleteCommonAndSemanticBrandParams(resp_data.items[i]);
|
||||
}
|
||||
|
||||
if (resp_data.items[i].items) {
|
||||
for (let j = 0; j < resp_data.items[i].items.length; j++) {
|
||||
if (resp_data.items[i].items[j].data?.card_type === 22
|
||||
|| resp_data.items[i].items[j].data?.ad_state === 1
|
||||
|| resp_data.items[i].items[j].data?.content_auth_info?.content_auth_title === "广告") {
|
||||
resp_data.items[i].items[j] = {};
|
||||
} else {
|
||||
deleteCommonAndSemanticBrandParams(resp_data.items[i].items[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('处理话题页面广告结束💕💕');
|
||||
}
|
||||
|
||||
// 8、超话tab页 微博超话tab页
|
||||
if (url.includes("/statuses/container_timeline_topic?")) {
|
||||
let foundFeed = false;
|
||||
const cardTypes = [19, 179]; // 19:热帖/必刷/分类,31:热搜词,179:关注的超话
|
||||
for (let i = 0; i < resp_data.items.length; i++) {
|
||||
const item = resp_data.items[i];
|
||||
if (item.data?.is_ad === 1 || item.data?.mblogtypename === "广告") {
|
||||
resp_data.items[i] = {};
|
||||
continue;
|
||||
}
|
||||
|
||||
const category = item.category; // feed/card/group
|
||||
const cardType = item.data?.card_type || "";
|
||||
if (cardTypes.includes(cardType)) {
|
||||
console.log(`保留的card_type = ${cardType}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 第一条微博往下的内容只要不是微博(分类、推广等),全部删除
|
||||
if (foundFeed && category !== "feed") {
|
||||
resp_data.items[i] = {};
|
||||
}
|
||||
if (category === "feed" || category === "card") {
|
||||
foundFeed = true;
|
||||
if (category === "card") {
|
||||
resp_data.items[i] = {};
|
||||
}
|
||||
}
|
||||
if (item.items) {
|
||||
for (let j = 0; j < item.items.length; j++) {
|
||||
const subItem = item.items[j];
|
||||
if (subItem.data?.card_type === 215) {
|
||||
item.items[j] = {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log('处理超话tab页广告结束💕💕');
|
||||
}
|
||||
|
||||
// 8、评论区广告
|
||||
if (url.includes("/comments/mix_comments?")) {
|
||||
resp_data.datas = resp_data.datas.filter(item => item.adType !== "广告");
|
||||
console.log('处理评论区广告结束💕💕');
|
||||
}
|
||||
if (url.includes("/statuses/container_detail_comment?")) {
|
||||
resp_data.items = resp_data.items.filter(item => item.type !== "trend");
|
||||
console.log('处理评论区广告结束💕💕');
|
||||
}
|
||||
|
||||
// 9、转发区广告
|
||||
if (url.includes("/statuses/container_detail_forward?")) {
|
||||
resp_data.items = resp_data.items.filter(item => item.type === "forward");
|
||||
console.log('处理转发区广告结束💕💕');
|
||||
}
|
||||
|
||||
console.log('广告数据处理完毕🧧🧧');
|
||||
} catch (e) {
|
||||
console.log('脚本运行出现错误,部分广告未去除⚠️');
|
||||
console.log('错误信息:' + e.message);
|
||||
}
|
||||
$done({body:JSON.stringify(resp_data)});
|
||||
/***************************方法主体end*********************************/
|
||||
|
||||
function processPayload(payload) {
|
||||
if (!payload) {
|
||||
return;
|
||||
}
|
||||
if (payload.items[0].items) {
|
||||
removeCommonAds(payload.items[0].items);
|
||||
}
|
||||
|
||||
removeCommonAds(payload.items);
|
||||
removeCategoryFeedAds(payload.items);
|
||||
|
||||
if (payload.loadedInfo?.headerBack) {
|
||||
delete payload.loadedInfo.headerBack;
|
||||
}
|
||||
}
|
||||
|
||||
function removeChannelsTabs(channels) {
|
||||
// 1001:发现,1015:趋势,1016:榜单,1040:热转,1041:热问,1043:智搜
|
||||
const channelIds = [1001, 1015, 1016, 1040, 1041, 1043];
|
||||
// 反向遍历数组
|
||||
for (let i = channels.length - 1; i >= 0; i--) {
|
||||
if (!channelIds.includes(channels[i].id)) {
|
||||
// 如果当前元素的id不在channelIds中,则从原数组中删除该元素
|
||||
channels.splice(i, 1);
|
||||
console.log('移除多余的channel💕💕');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeHeaderAds(headerItems) {
|
||||
removeCommonAds(headerItems);
|
||||
for (let i = 0; i < headerItems.length; i++) {
|
||||
if (headerItems[i].items) {
|
||||
removeCommonAds(headerItems[i].items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeCommonAds(items) {
|
||||
// 模块类型,不在里面的都计划删除
|
||||
// 17:微博热搜,101:热门微博
|
||||
const cardTypes = [17, 101];
|
||||
|
||||
let firstVerticalFound = false;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (items[i].type === "vertical") {
|
||||
if (!firstVerticalFound) {
|
||||
firstVerticalFound = true;
|
||||
continue;
|
||||
}
|
||||
console.log('移除内嵌的模块💕💕');
|
||||
items[i] = {};
|
||||
continue;
|
||||
}
|
||||
|
||||
const card_type = items[i].data?.card_type;
|
||||
console.log(`card_type = ${card_type}`);
|
||||
// 白名单模式
|
||||
if (card_type && !cardTypes.includes(card_type)) {
|
||||
console.log(`移除多余的模块:${card_type}💕💕`);
|
||||
items[i] = {};
|
||||
continue;
|
||||
}
|
||||
// 1.1、"微博热搜"模块
|
||||
if (card_type === 17) {
|
||||
console.log('处理微博热搜模块💕💕');
|
||||
removeHotSearchAds(items[i].data.group);
|
||||
}
|
||||
// 118横版广告图片 182热议话题 217错过了热词 247横版视频广告 236微博趋势
|
||||
// 删除信息流中的图片广告、推广
|
||||
deleteCommonAndSemanticBrandParams(items[i])
|
||||
}
|
||||
}
|
||||
|
||||
// 移除“微博热搜”的广告
|
||||
function removeHotSearchAds(groups) {
|
||||
if (!groups) return;
|
||||
console.log('移除发现页热搜广告开始💕');
|
||||
for (let i = groups.length - 1; i >= 0; i--) {
|
||||
const group = groups[i];
|
||||
if (group.itemid?.includes("is_ad_pos") || group.itemid?.includes("cate_type:tongcheng") || group.promotion) {
|
||||
groups.splice(i, 1);
|
||||
}
|
||||
}
|
||||
console.log('移除发现页热搜广告结束💕💕');
|
||||
}
|
||||
|
||||
// 移除“热搜微博”信息流的广告
|
||||
function removeCategoryFeedAds(items) {
|
||||
console.log('移除发现页热门微博广告💕');
|
||||
for (let i = items.length - 1; i >= 0; i--) {
|
||||
const item = items[i];
|
||||
if (item.category === "feed" && item.data && item.data.mblogtypename === "广告") {
|
||||
items.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 移除微博首页的多余tab页
|
||||
function removePageDataAds(items) {
|
||||
console.log('移除微博首页的多余tab页💕');
|
||||
for (let i = items.length - 1; i >= 0; i--) {
|
||||
const item = items[i];
|
||||
if (item.pageDataType === "homeExtend") {
|
||||
items.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 删除一条微博下面的图片广告
|
||||
function deleteCommonAndSemanticBrandParams(item) {
|
||||
// 删除信息流中的图片广告、推广
|
||||
if (item.data?.extend_info?.shopwindow_cards) {
|
||||
delete item.data.extend_info.shopwindow_cards
|
||||
}
|
||||
if (item.data?.extend_info?.ad_semantic_brand) {
|
||||
delete item.data.extend_info.ad_semantic_brand
|
||||
}
|
||||
if (item.data?.common_struct) {
|
||||
delete item.data.common_struct;
|
||||
}
|
||||
if (item.data?.semantic_brand_params) {
|
||||
delete item.data.semantic_brand_params;
|
||||
}
|
||||
}
|
||||
222
Scripts/weibo/weibo_ads_android.js
Normal file
222
Scripts/weibo/weibo_ads_android.js
Normal file
@ -0,0 +1,222 @@
|
||||
/**
|
||||
* author:fmz200
|
||||
* @function 微博去广告
|
||||
* date:2023-11-29 10:13:00
|
||||
*/
|
||||
|
||||
// 在请求到达服务器之前,调用此函数,您可以在此处修改请求数据
|
||||
async function onRequest(context, request) {
|
||||
console.log("请求URL=" + request.url);
|
||||
//URL参数
|
||||
request.queries["reqParams"] = "value";
|
||||
//更新或添加新标头
|
||||
request.headers["X-New-Headers"] = "My-Value";
|
||||
delete request.headers["Key-Need-Delete"];
|
||||
|
||||
//Update Body 使用fetch API请求接口,具体文档可网上搜索fetch API
|
||||
//request.body = await fetch('https://www.baidu.com/').then(response => response.text());
|
||||
|
||||
//共享参数 后面onResponse时取出
|
||||
context["request_url"] = request.url;
|
||||
return request;
|
||||
}
|
||||
|
||||
// 在将响应数据发送到客户端之前,调用此函数,您可以在此处修改响应数据
|
||||
async function onResponse(context, request, response) {
|
||||
const url1 = '/search/finder';
|
||||
const url2 = '/search/container_timeline'; // 发现页面
|
||||
const url3 = '/search/container_discover';
|
||||
const url4 = '/api.weibo.cn/2/page'; // 微博热搜页面url
|
||||
const url5 = '/statuses/container_timeline_topicpage'; // 微博超话页面
|
||||
const url6 = '/statuses/extend'; // 微博详情页面广告
|
||||
const url7 = '/groups/allgroups/v2' // 微博首页Tab标签页
|
||||
|
||||
let index = 1;
|
||||
|
||||
// 更新或添加新标头
|
||||
// response.headers["Name"] = context["name"];
|
||||
|
||||
// Update status Code
|
||||
// response.statusCode = 500;
|
||||
|
||||
let url = context["request_url"];
|
||||
let body = response.body;
|
||||
console.log("响应URL=" + url);
|
||||
let resp_data = JSON.parse(body);
|
||||
try {
|
||||
// 1、首次点击发现按钮
|
||||
if (url.includes(url1)) {
|
||||
const payload = resp_data.channelInfo?.channels?.[0]?.payload;
|
||||
console.log('进入发现页...');
|
||||
if (payload.items[1].data.itemid === "hot_search_push") {
|
||||
index = 2;
|
||||
}
|
||||
|
||||
// 1.1、下标是1的为热搜模块
|
||||
payload.items[index].data.group = removeHotSearchAds(payload.items[index].data.group);
|
||||
|
||||
// 1.2、下标为2的是轮播图模块
|
||||
console.log('移除轮播模块💕💕');
|
||||
payload.items[index + 1] = {};
|
||||
|
||||
// 1.3、下标为3的是热议模块
|
||||
console.log('移除finder_channel模块💕💕');
|
||||
if (payload.items[index + 2].data?.more_pic?.includes('ads')) {
|
||||
delete payload.items[index + 2].data.more_pic;
|
||||
}
|
||||
payload.items[index + 2].data.group = removeFinderChannelAds(payload.items[index + 2].data.group);
|
||||
|
||||
// 1.4、items[i].category = "feed" 是热门微博的部分
|
||||
payload.items = removeCategoryFeedAds(payload.items);
|
||||
|
||||
// 1.5、背景图广告
|
||||
if (payload.loadedInfo?.headerBack) {
|
||||
delete payload.loadedInfo.headerBack;
|
||||
}
|
||||
}
|
||||
|
||||
// 2、发现页面刷新/再次点击发现按钮
|
||||
if (url.includes(url2) || url.includes(url3)) {
|
||||
console.log('刷新发现页...');
|
||||
if (resp_data.items[1].data.itemid === "hot_search_push") {
|
||||
index = 2;
|
||||
}
|
||||
|
||||
// 2.1、下标是1的为热搜模块
|
||||
resp_data.items[index].data.group = removeHotSearchAds(resp_data.items[index].data.group);
|
||||
|
||||
// 2.2、下标为2的是轮播图模块
|
||||
console.log('移除轮播图模块🤣🤣');
|
||||
resp_data.items[index + 1] = {};
|
||||
|
||||
// 2.3、下标为3的是热议模块
|
||||
console.log('移除finder_channel模块💕💕');
|
||||
if (resp_data.items[index + 2].data?.more_pic?.includes('ads')) {
|
||||
delete resp_data.items[index + 2].data.more_pic;
|
||||
}
|
||||
resp_data.items[index + 2].data.group = removeFinderChannelAds(resp_data.items[index + 2].data.group);
|
||||
|
||||
// 2.4、items[i].category = "feed" 是热门微博的部分
|
||||
resp_data.items = removeCategoryFeedAds(resp_data.items);
|
||||
|
||||
// 2.5、背景图广告
|
||||
if (resp_data.loadedInfo?.headerBack) {
|
||||
delete resp_data.loadedInfo.headerBack;
|
||||
}
|
||||
}
|
||||
|
||||
// 3、微博热搜页面刷新
|
||||
if (url.includes(url4) && resp_data.cards && resp_data.cards[0].card_group) {
|
||||
console.log('微博热搜页面广告开始💕');
|
||||
resp_data.cards[0].card_group = resp_data.cards[0].card_group.filter(group => group.promotion == null);
|
||||
console.log('微博热搜页面广告结束💕💕');
|
||||
}
|
||||
|
||||
// 4、微博超话页面
|
||||
if (url.includes(url5) && resp_data.items) {
|
||||
console.log('微博超话页面广告开始💕');
|
||||
resp_data.items = resp_data.items.filter(item => !item.data || item.data.mblogtypename !== "广告");
|
||||
console.log('微博超话页面广告结束💕💕');
|
||||
}
|
||||
|
||||
// 5、微博超话页面
|
||||
if (url.includes(url6)) {
|
||||
console.log('微博详情页面广告开始💕');
|
||||
resp_data.head_cards = [];
|
||||
console.log('微博详情页面广告结束💕💕');
|
||||
}
|
||||
|
||||
// 6、移除微博首页的多余tab页
|
||||
if (url.includes(url7)) {
|
||||
resp_data.pageDatas = removePageDataAds(resp_data.pageDatas);
|
||||
swapObjectsInArray(resp_data.pageDatas[0].categories[0].pageDatas, 0, 1);
|
||||
}
|
||||
console.log('没有广告数据🧧🧧');
|
||||
} catch (e) {
|
||||
console.log('脚本运行出现错误,部分广告未去除⚠️');
|
||||
console.log('错误信息:' + e.message);
|
||||
}
|
||||
|
||||
response.body = JSON.stringify(resp_data);
|
||||
return response;
|
||||
}
|
||||
|
||||
// 移除“微博热搜”的广告
|
||||
function removeHotSearchAds(groups) {
|
||||
if (!groups) return;
|
||||
console.log('移除发现页热搜广告开始💕');
|
||||
const newGroups = groups.filter(group => !(group.itemid?.includes("is_ad_pos") || group.promotion));
|
||||
console.log('移除发现页热搜广告结束💕💕');
|
||||
return newGroups;
|
||||
}
|
||||
|
||||
// 移除“微博热搜”下面的“热聊,本地等”的广告
|
||||
function removeFinderChannelAds(groups) {
|
||||
if (!groups) return;
|
||||
|
||||
const titleSubPicMap = {
|
||||
'电影': 'https://simg.s.weibo.com/imgtool/20221207_dianying.png',
|
||||
'热议': 'https://simg.s.weibo.com/20220402_hottopic-icon.png',
|
||||
'影像年': 'https://simg.s.weibo.com/ads/1%2Fads_1692185628.png',
|
||||
'本地': 'https://simg.s.weibo.com/20190123154142_tongcheng.png',
|
||||
'亚运电竞': 'https://simg.s.weibo.com/ads/1%2Fads_1694765662.png',
|
||||
'直播': 'https://simg.s.weibo.com/20210705_live0705.png',
|
||||
'财经': 'https://simg.s.weibo.com/20190124150415_caijing.png',
|
||||
'找人': 'https://simg.s.weibo.com/20190125144608_zhaoren.png',
|
||||
'时尚': 'https://simg.s.weibo.com/imgtool/20220928_fashion.png',
|
||||
'长文': 'https://simg.s.weibo.com/20220621_%E9%95%BF%E6%96%87%E5%8F%91%E7%8E%B0%E9%A1%B5icon%403x.png',
|
||||
'赛事': 'https://simg.s.weibo.com/20201030_%E8%B5%9B%E4%BA%8B.png',
|
||||
'教育': 'https://simg.s.weibo.com/20200303_edu0303.png',
|
||||
'音乐': 'https://simg.s.weibo.com/imgtool/20221207_yinyue.png',
|
||||
'房产': 'https://simg.s.weibo.com/20190129182003_house.png',
|
||||
'小游戏': 'https://simg.s.weibo.com/20190118185226_youxi.png',
|
||||
'美食': 'https://simg.s.weibo.com/imgtool/20221207_food.png',
|
||||
'热聊': 'https://simg.s.weibo.com/20220402_reliao.png',
|
||||
'新知': 'https://simg.s.weibo.com/20211105_xinzhi.png',
|
||||
'微公益': 'https://simg.s.weibo.com/ads/1%2Fads_1689323535.png',
|
||||
'大健康': 'https://simg.s.weibo.com/imgtool/20221116_health.png',
|
||||
'活动': 'https://simg.s.weibo.com/20200915_huodong.png',
|
||||
'母婴': 'https://simg.s.weibo.com/20210222_mombaby.png',
|
||||
'珠宝玉石': 'https://simg.s.weibo.com/20210317_yushi.png',
|
||||
'游戏中心': 'https://simg.s.weibo.com/ads/1%2Fads_1687759038.png'
|
||||
};
|
||||
console.log('移除发现页finder_channel广告开始💕');
|
||||
const newGroups = [];
|
||||
for (const group of groups) {
|
||||
if (group.pic?.includes('ads')) {
|
||||
group.pic = titleSubPicMap[group.title_sub] || "https://simg.s.weibo.com/20200915_huodong.png";
|
||||
}
|
||||
newGroups.push(group);
|
||||
}
|
||||
console.log('移除发现页finder_channel广告结束💕💕');
|
||||
return newGroups;
|
||||
}
|
||||
|
||||
// 移除“热搜微博”信息流的广告
|
||||
function removeCategoryFeedAds(items) {
|
||||
console.log('移除发现页热门微博广告开始💕');
|
||||
const newItems = items.filter(item => item.category !== "feed" || (item.data && item.data.mblogtypename !== "广告"));
|
||||
console.log('移除发现页热门微博广告结束💕💕');
|
||||
return newItems;
|
||||
}
|
||||
|
||||
// 移除微博首页的多余tab页
|
||||
function removePageDataAds(items) {
|
||||
console.log('移除微博首页的多余tab页开始💕');
|
||||
const newItems = items.filter(item => item.pageDataType !== "homeExtend");
|
||||
console.log('移除微博首页的多余tab页结束💕💕');
|
||||
return newItems;
|
||||
}
|
||||
|
||||
// 交换集合中两个对象的位置
|
||||
function swapObjectsInArray(array, index1, index2) {
|
||||
console.log('交换tab页顺序开始💕');
|
||||
const temp = array[index1];
|
||||
array[index1] = array[index2];
|
||||
array[index2] = temp;
|
||||
|
||||
array[index2].type = array[index1].type;
|
||||
array[index2].apipath = "statuses/container_timeline_unread";
|
||||
delete array[index2].navigation_title;
|
||||
console.log('交换tab页顺序结束💕💕');
|
||||
}
|
||||
782
Scripts/weibo/weibo_main.js
Normal file
782
Scripts/weibo/weibo_main.js
Normal file
File diff suppressed because one or more lines are too long
121
Scripts/weibo/weibo_signin.js
Normal file
121
Scripts/weibo/weibo_signin.js
Normal file
File diff suppressed because one or more lines are too long
23
Scripts/weibo/weibo_vip.js
Normal file
23
Scripts/weibo/weibo_vip.js
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @author fmz200
|
||||
* @function 解锁微博会员图标
|
||||
* @date 2024-06-13 09:20:00
|
||||
*
|
||||
* [MITM]
|
||||
* hostname = new.vip.weibo.cn
|
||||
*
|
||||
* [rewrite_local]
|
||||
* ^https?://new\.vip\.weibo\.cn/aj/appicon/list url script-response-body https://github.com/fmz200/wool_scripts/raw/main/Scripts/weibo/weibo_vip.js
|
||||
*/
|
||||
|
||||
let body = $response.body;
|
||||
let obj = JSON.parse(body);
|
||||
|
||||
if (obj.data?.list) {
|
||||
obj.data.list.forEach(function (item) {
|
||||
item.cardType = "2";
|
||||
item.tag = "";
|
||||
});
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(obj)});
|
||||
137
Scripts/weibo/weibotalk.cookie.js
Normal file
137
Scripts/weibo/weibotalk.cookie.js
Normal file
@ -0,0 +1,137 @@
|
||||
/**********
|
||||
🐬作者
|
||||
@Evilbutcher。 https://github.com/evilbutcher
|
||||
@toulanboy。https://github.com/toulanboy/scripts
|
||||
|
||||
📌不定期更新各种签到、有趣的脚本,欢迎star🌟
|
||||
|
||||
***********************************
|
||||
【配置步骤,请认真阅读,每一个细节都很重要】
|
||||
***********************************
|
||||
1. 根据你当前的软件,配置好srcipt。由于是远程文件,记得顺便更新文件。
|
||||
2. 打开微博APP --> 底部栏“我的“ --> 中间的”超话社区“ --> 底部栏"我的" --> ”关注“, 弹出通知,提示获取已关注超话链接成功。
|
||||
3. 点进一个超话页面,手动签到一次。弹出通知,提示获取超话签到链接成功。 若之前所有已经签到,请关注一个新超话进行签到。
|
||||
4. 回到quanx等软件,关掉获取cookie的rewrite。(loon是关掉获取cookie的脚本)
|
||||
|
||||
📌 配置第2个账号方法:第1个账号获取cookie结束后。在微博app中切换到第2个号,进行相同的获取逻辑。
|
||||
|
||||
***************************************
|
||||
【boxjs 订阅, 用于修改脚本配置】
|
||||
***************************************
|
||||
box订阅链接:https://raw.githubusercontent.com/toulanboy/scripts/master/toulanboy.boxjs.json
|
||||
订阅后,可以在box里面进行 cookie清空、通知个数、签到延迟 等设置.
|
||||
|
||||
*************************
|
||||
【Surge 4.2+ 脚本配置】
|
||||
*************************
|
||||
微博超话cookie获取 = type=http-request,pattern=^https?://m?api\.weibo\.c(n|om)\/2\/(cardlist|page\/button),script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.cookie.js
|
||||
微博超话 = type=cron,cronexp="5 0 * * *",script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.js,wake-system=true,timeout=600
|
||||
|
||||
*************************
|
||||
【Loon 2.1+ 脚本配置】
|
||||
*************************
|
||||
[script]
|
||||
cron "5 0 * * *" script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.js, timeout=600, tag=微博超话
|
||||
http-request ^https?://m?api\.weibo\.c(n|om)\/2\/(cardlist|page\/button) script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.cookie.js,requires-body=false, tag=微博超话cookie获取
|
||||
|
||||
*************************
|
||||
【 QX 1.0.10+ 脚本配置 】
|
||||
*************************
|
||||
[rewrite_local]
|
||||
^https?://m?api\.weibo\.c(n|om)\/2\/(cardlist|page\/button) url script-request-header https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.cookie.js
|
||||
[task]
|
||||
5 0 * * * https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.js, tag=微博超话
|
||||
|
||||
|
||||
[MITM]
|
||||
hostname = api.weibo.cn
|
||||
|
||||
*********/
|
||||
$ = new Env("微博超话")
|
||||
//账号1
|
||||
const tokenurl = 'evil_tokenurl';
|
||||
const tokencheckinurl = 'evil_tokencheckinurl'
|
||||
const tokenheaders = 'evil_tokenheaders'
|
||||
const tokencheckinheaders = 'evil_tokencheckinheaders'
|
||||
//账号2
|
||||
const tokenurl2 = 'evil_tokenurl2';
|
||||
const tokencheckinurl2 = 'evil_tokencheckinurl2'
|
||||
const tokenheaders2= 'evil_tokenheaders2'
|
||||
const tokencheckinheaders2 = 'evil_tokencheckinheaders2'
|
||||
|
||||
if ($request && $request.method != 'OPTIONS' && $request.url.match(/\_\-\_myfollow.*?need\_head\_cards/) && $request.url.match(/cardlist/)){
|
||||
const listurl = $request.url
|
||||
const listheaders = JSON.stringify($request.headers)
|
||||
if ($.getdata(tokenurl) == undefined || $.getdata(tokenurl) == "") {
|
||||
console.log(listurl)
|
||||
$.setdata(listurl, tokenurl)
|
||||
$.setdata(listheaders, tokenheaders)
|
||||
$.msg("微博超话 [账号一]", "✅获取已关注超话列表成功", "✨接下来,请点进一个超话进行签到\n如果没有签到的超话,请关注新的进行签到。")
|
||||
}
|
||||
else {
|
||||
if (!($.getdata(tokencheckinurl) == undefined || $.getdata(tokencheckinurl) == "") && listurl != $.getdata(tokenurl)) {
|
||||
console.log(listurl)
|
||||
$.setdata(listurl, tokenurl2)
|
||||
$.setdata(listheaders, tokenheaders2)
|
||||
$.msg("微博超话 [账号二]", "✅获取已关注超话列表成功", "✨接下来,请点进一个超话进行签到\n如果没有签到的超话,请关注新的进行签到。")
|
||||
}
|
||||
}
|
||||
} else if ($request && $request.method != 'OPTIONS' && $request.url.match(/active\_checkin/) && $request.url.match(/page\/button/)){
|
||||
const checkinurl = $request.url
|
||||
|
||||
const checkinheaders = JSON.stringify($request.headers)
|
||||
if (($.getdata(tokenurl) != undefined && $.getdata(tokenurl) != "") && ($.getdata(tokencheckinurl) == undefined || $.getdata(tokencheckinurl) == "")) {
|
||||
console.log(checkinurl)
|
||||
$.setdata(checkinurl, tokencheckinurl)
|
||||
$.setdata(checkinheaders, tokencheckinheaders)
|
||||
$.msg("微博超话 [账号一]", "🎉获取超话签到链接成功", `若之前已弹出【获取已关注列表成功】的通知,那么已完成当前账号cookie获取。\n🚨若你只需要签到1个账号,请现在去关闭获取cookie的脚本或重写。`)
|
||||
|
||||
}
|
||||
else {
|
||||
if (!($.getdata(tokenurl2) == undefined || $.getdata(tokenurl2) == "")) {
|
||||
console.log(checkinurl)
|
||||
$.setdata(checkinurl, tokencheckinurl2)
|
||||
$.setdata(checkinheaders, tokencheckinheaders2)
|
||||
$.msg("微博超话 [账号二]", "🎉获取超话签到链接成功", `若之前已弹出【获取已关注列表成功】的通知,那么已完成当前账号cookie获取。\n🚨请关闭获取cookie的脚本或重写,然后可以愉快使用了。`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$.done()
|
||||
|
||||
//@Chavy
|
||||
function Env(s) {
|
||||
this.name = s, this.data = null, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.isNode = (() => "undefined" != typeof module && !!module.exports), this.log = ((...s) => {
|
||||
this.logs = [...this.logs, ...s], s ? console.log(s.join("\n")) : console.log(this.logs.join("\n"))
|
||||
}), this.msg = ((s = this.name, t = "", i = "") => {
|
||||
this.isSurge() && $notification.post(s, t, i), this.isQuanX() && $notify(s, t, i);
|
||||
const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
|
||||
s && e.push(s), t && e.push(t), i && e.push(i), console.log(e.join("\n"))
|
||||
}), this.getdata = (s => {
|
||||
if (this.isSurge()) return $persistentStore.read(s);
|
||||
if (this.isQuanX()) return $prefs.valueForKey(s);
|
||||
if (this.isNode()) {
|
||||
const t = "box.dat";
|
||||
return this.fs = this.fs ? this.fs : require("fs"), this.fs.existsSync(t) ? (this.data = JSON.parse(this.fs.readFileSync(t)), this.data[s]) : null
|
||||
}
|
||||
}), this.setdata = ((s, t) => {
|
||||
if (this.isSurge()) return $persistentStore.write(s, t);
|
||||
if (this.isQuanX()) return $prefs.setValueForKey(s, t);
|
||||
if (this.isNode()) {
|
||||
const i = "box.dat";
|
||||
return this.fs = this.fs ? this.fs : require("fs"), !!this.fs.existsSync(i) && (this.data = JSON.parse(this.fs.readFileSync(i)), this.data[t] = s, this.fs.writeFileSync(i, JSON.stringify(this.data)), !0)
|
||||
}
|
||||
}), this.wait = ((s, t = s) => i => setTimeout(() => i(), Math.floor(Math.random() * (t - s + 1) + s))), this.get = ((s, t) => this.send(s, "GET", t)), this.post = ((s, t) => this.send(s, "POST", t)), this.send = ((s, t, i) => {
|
||||
if (this.isSurge()) {
|
||||
const e = "POST" == t ? $httpClient.post : $httpClient.get;
|
||||
e(s, (s, t, e) => {
|
||||
t && (t.body = e, t.statusCode = t.status), i(s, t, e)
|
||||
})
|
||||
}
|
||||
this.isQuanX() && (s.method = t, $task.fetch(s).then(s => {
|
||||
s.status = s.statusCode, i(null, s, s.body)
|
||||
}, s => i(s.error, s, s))), this.isNode() && (this.request = this.request ? this.request : require("request"), s.method = t, s.gzip = !0, this.request(s, (s, t, e) => {
|
||||
t && (t.status = t.statusCode), i(null, t, e)
|
||||
}))
|
||||
}), this.done = ((s = {}) => this.isNode() ? null : $done(s))
|
||||
}
|
||||
341
Scripts/weibo/weibotalk.js
Normal file
341
Scripts/weibo/weibotalk.js
Normal file
@ -0,0 +1,341 @@
|
||||
/**********
|
||||
微博超话签到修改版
|
||||
需要12.2.1以下版本抓包
|
||||
更新时间:2025-05-27 22:00:00
|
||||
|
||||
🐬作者
|
||||
@Evilbutcher。 https://github.com/evilbutcher
|
||||
@toulanboy。https://github.com/toulanboy/scripts
|
||||
|
||||
📌不定期更新各种签到、有趣的脚本,欢迎star🌟
|
||||
|
||||
***********************************
|
||||
【配置步骤,请认真阅读,每一个细节都很重要】
|
||||
***********************************
|
||||
1. 根据你当前的软件,配置好script。由于是远程文件,记得顺便更新文件。
|
||||
2. 打开微博APP --> 底部栏“我的“ --> 中间的”超话社区“ --> 底部栏"我的" --> ”关注“, 弹出通知,提示获取已关注超话链接成功。
|
||||
3. 点进一个超话页面,手动签到一次。弹出通知,提示获取超话签到链接成功。 若之前所有已经签到,请关注一个新超话进行签到。
|
||||
4. 回到quanx等软件,关掉获取cookie的rewrite。(loon是关掉获取cookie的脚本)
|
||||
|
||||
📌 配置第2个账号方法:第1个账号获取cookie结束后。在微博app中切换到第2个号,进行相同的获取逻辑。
|
||||
|
||||
***************************************
|
||||
【boxjs 订阅, 用于修改脚本配置】
|
||||
***************************************
|
||||
box订阅链接:https://raw.githubusercontent.com/toulanboy/scripts/master/toulanboy.boxjs.json
|
||||
订阅后,可以在box里面进行 cookie清空、通知个数、签到延迟 等设置.
|
||||
|
||||
*************************
|
||||
【Surge 4.2+ 脚本配置】
|
||||
*************************
|
||||
微博超话cookie获取 = type=http-request,pattern=^https?://m?api\.weibo\.c(n|om)\/2\/(cardlist|page\/button),script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.cookie.js
|
||||
微博超话 = type=cron,cronexp="5 0 * * *",script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.js,wake-system=true,timeout=600
|
||||
|
||||
*************************
|
||||
【Loon 2.1+ 脚本配置】
|
||||
*************************
|
||||
[script]
|
||||
cron "5 0 * * *" script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.js, timeout=600, tag=微博超话
|
||||
http-request ^https?://m?api\.weibo\.c(n|om)\/2\/(cardlist|page\/button) script-path=https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.cookie.js,requires-body=false, tag=微博超话cookie获取
|
||||
|
||||
*************************
|
||||
【 QX 1.0.10+ 脚本配置 】
|
||||
*************************
|
||||
[rewrite_local]
|
||||
^https?://m?api\.weibo\.c(n|om)\/2\/(cardlist|page\/button) url script-request-header https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.cookie.js
|
||||
[task]
|
||||
5 0 * * * https://raw.githubusercontent.com/toulanboy/scripts/master/weibo/weibotalk.js, tag=微博超话
|
||||
|
||||
|
||||
[MITM]
|
||||
hostname = api.weibo.cn
|
||||
|
||||
*********/
|
||||
|
||||
const $ = new Env("微博超话")
|
||||
|
||||
/*
|
||||
* 可自定义的参数
|
||||
*/
|
||||
$.delete_cookie = false //若需要清空cookie,请把它置为true。清空完毕后,请重新置为false.
|
||||
$.msg_max_num = 30 //一个通知显示30个超话的签到情况
|
||||
$.time = 700 //【签到间隔,单位ms】,若超话过多,建议填1000ms以上。
|
||||
let debug = false
|
||||
|
||||
!(async () => {
|
||||
if (!get_setting()) return
|
||||
if (!get_counts()) return
|
||||
console.log(`🌟 账号数 = ${$.count_num}`)
|
||||
for (let current = 1; current <= $.count_num; ++current) {
|
||||
init_env(current)
|
||||
await get_page_number();
|
||||
console.log(`🌟 get_page_number 执行完成`)
|
||||
for (let i = 1; i <= $.pagenumber; i++) {
|
||||
//console.log(`🌟 get_talk_id ${i}`)
|
||||
await get_talk_id(i);
|
||||
//console.log(`🌟 get_talk_id ${i}执行完成`)
|
||||
}
|
||||
for (let i in $.name_list) {
|
||||
await checkin($.id_list[i], $.name_list[i]);
|
||||
$.wait($.time);
|
||||
}
|
||||
output(current)
|
||||
}
|
||||
})()
|
||||
.catch((e) => {
|
||||
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||
})
|
||||
.finally(() => {
|
||||
$.done()
|
||||
})
|
||||
|
||||
function get_setting() {
|
||||
$.delete_cookie = JSON.parse($.getdata('wb_delete_cookie') || $.delete_cookie)
|
||||
$.msg_max_num = $.getdata('wb_msg_max_num') * 1 || $.msg_max_num
|
||||
$.time = $.getdata('wb_request_time') * 1 || $.time
|
||||
|
||||
$.listurl = $.getdata("evil_tokenurl");
|
||||
$.listheaders = $.getdata("evil_tokenheaders");
|
||||
$.checkinurl = $.getdata("evil_tokencheckinurl");
|
||||
$.checkinheaders = $.getdata("evil_tokencheckinheaders");
|
||||
|
||||
$.listurl2 = $.getdata("evil_tokenurl2");
|
||||
$.listheaders2 = $.getdata("evil_tokenheaders2");
|
||||
$.checkinurl2 = $.getdata("evil_tokencheckinurl2");
|
||||
$.checkinheaders2 = $.getdata("evil_tokencheckinheaders2");
|
||||
if ($.delete_cookie) {
|
||||
$.setdata("", "evil_tokenurl")
|
||||
$.setdata("", "evil_tokenheaders")
|
||||
$.setdata("", "evil_tokencheckinurl")
|
||||
$.setdata("", "evil_tokencheckinheaders")
|
||||
|
||||
$.setdata("", "evil_tokenurl2")
|
||||
$.setdata("", "evil_tokenheaders2")
|
||||
$.setdata("", "evil_tokencheckinurl2")
|
||||
$.setdata("", "evil_tokencheckinheaders2")
|
||||
$.setdata("false", "wb_delete_cookie")
|
||||
$.msg($.name, "", "✅已清空cookie,同时已关闭清空功能。\n🔍请按流程开始获取cookie把~")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function get_counts() {
|
||||
$.count_num = 0;
|
||||
if ($.listurl == undefined || $.listurl == "" ||
|
||||
$.listheaders == undefined || $.listheaders == "" ||
|
||||
$.checkinurl == undefined || $.checkinurl == "" ||
|
||||
$.checkinheaders == undefined || $.checkinheaders == "") {
|
||||
$.msg($.name, "🚫cookie不完整 或 没有cookie", "🚫请认真阅读配置,按流程获取cookie。\n🔍若仍无法解决,请先清空cookie再获取。\n🔍如何清空?\n1️⃣本地文件:将文件内delete_cookie置为true。\n2️⃣远程文件:使用boxjs,在box内打开清空cookie开关")
|
||||
return false;
|
||||
} else {
|
||||
$.count_num = 1
|
||||
}
|
||||
if (!($.listurl2 == undefined || $.listurl2 == "" ||
|
||||
$.listheaders2 == undefined || $.listheaders2 == "" ||
|
||||
$.checkinurl2 == undefined || $.checkinurl2 == "" ||
|
||||
$.checkinheaders2 == undefined || $.checkinheaders2 == "")) {
|
||||
$.count_num = 2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function init_env(current) {
|
||||
console.log(`🌟 清空环境,开始账号 ${current}`)
|
||||
$.message = [];
|
||||
$.name_list = []
|
||||
$.id_list = []
|
||||
$.val_list = []
|
||||
$.successNum = 0
|
||||
$.failNum = 0
|
||||
$.allnumber = 0;
|
||||
$.pagenumber = 0;
|
||||
$.stopNum = 0;
|
||||
if (current === 2) {
|
||||
$.listurl = $.listurl2
|
||||
$.listheaders = $.listheaders2
|
||||
$.checkinurl = $.checkinurl2
|
||||
$.checkinheaders = $.checkinheaders2
|
||||
}
|
||||
}
|
||||
|
||||
function output(current) {
|
||||
$.this_msg = ""
|
||||
for (var i = 1; i <= $.message.length; ++i) {
|
||||
if (i % ($.msg_max_num) === 0) {
|
||||
$.msg(`${$.name}${$.count_num === 1 ? "" : (current === 1 ? "[账号一]" : "[账号二]")}: 成功${$.successNum}个,失败${$.failNum}`, `当前第${Math.ceil(i / $.msg_max_num)}页 ,共${Math.ceil($.message.length / $.msg_max_num)}页`, $.this_msg)
|
||||
$.this_msg = ""
|
||||
}
|
||||
$.this_msg += `${$.message[i - 1]}\n`
|
||||
}
|
||||
if ($.message.length % $.msg_max_num !== 0) {
|
||||
$.msg(`${$.name}${$.count_num === 1 ? "" : (current === 1 ? "[账号一]" : "[账号二]")}: 成功${$.successNum}个,失败${$.failNum}`, `当前第${Math.ceil((i - 1) / $.msg_max_num)}页 ,共${Math.ceil($.message.length / $.msg_max_num)}页`, $.this_msg)
|
||||
}
|
||||
}
|
||||
|
||||
function get_page_number() {
|
||||
return new Promise((resolve) => {
|
||||
let request = {
|
||||
url: $.listurl,
|
||||
header: $.listheaders
|
||||
};
|
||||
$.get(request, (error, response, data) => {
|
||||
if (error) {
|
||||
throw new Error(error)
|
||||
}
|
||||
let body = response.body;
|
||||
let obj = JSON.parse(body);
|
||||
if (obj.hasOwnProperty('errmsg') || obj.cardlistInfo.total == undefined) {
|
||||
$.msg($.name, "🚨获取页数出现错误", `⚠️微博原话:${obj.errmsg}\n🧑🏻💻作者:账号过期了,清空cookie吧,重新获取。`)
|
||||
$.pagenumber = 0
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
$.allnumber = obj.cardlistInfo.total;
|
||||
console.log("当前已关注超话" + $.allnumber + "个");
|
||||
// $.message.push(`当前已关注超话${allnumber}个`);
|
||||
$.pagenumber = Math.ceil($.allnumber / 25);
|
||||
//$notify("超话","",JSON.stringify($.message))
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//获取超话签到id
|
||||
function get_talk_id(page) {
|
||||
let getlisturl = $.listurl.replace(/&page=.*?&/, "&page=" + page + "&");
|
||||
// console.log(getlisturl);
|
||||
let idrequest = {
|
||||
url: getlisturl,
|
||||
header: $.listheaders
|
||||
};
|
||||
// console.log(idrequest)
|
||||
return new Promise((resolve) => {
|
||||
$.get(idrequest, (error, response, data) => {
|
||||
if (error) {
|
||||
throw new Error(error)
|
||||
}
|
||||
let body = response.body;
|
||||
let obj = JSON.parse(body);
|
||||
if (obj.hasOwnProperty('errmsg') || obj.cards === undefined || obj.cards == null) {
|
||||
$.msg($.name, "🚨获取超话ID出现错误", `⚠️微博原话:${obj.errmsg}\n`)
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
let group = obj.cards[0]["card_group"];
|
||||
let number = group.length;
|
||||
for (let i = 0; i < number; i++) {
|
||||
let name = group[i]["title_sub"];
|
||||
$.name_list.push(name)
|
||||
let val = group[i].desc;
|
||||
$.val_list.push(val)
|
||||
let id = group[i].scheme.slice(33, 71);
|
||||
$.id_list.push(id)
|
||||
if (debug) {
|
||||
console.log(name)
|
||||
console.log(val)
|
||||
console.log(id)
|
||||
}
|
||||
// checkin(id, name, val, time);
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
//签到
|
||||
function checkin(id, name) {
|
||||
let sendcheckinurl = $.checkinurl
|
||||
.replace(/&fid=.*?&/, "&fid=" + id + "&")
|
||||
.replace(/pageid%3D.*?%26/, "pageid%3D" + id + "%26");
|
||||
let checkinrequest = {
|
||||
url: sendcheckinurl,
|
||||
header: $.checkinheaders
|
||||
};
|
||||
return new Promise(resolve => {
|
||||
$.get(checkinrequest, (error, response, data) => {
|
||||
if (error) {
|
||||
throw new Error(error)
|
||||
}
|
||||
name = name.replace(/超话/, "")
|
||||
if (response.statusCode == 200) {
|
||||
msg_info = JSON.parse(response.body);
|
||||
console.log(response.body);
|
||||
if (msg_info.hasOwnProperty('errmsg')) {
|
||||
$.failNum += 1;
|
||||
error_code = msg_info.errcode;
|
||||
if (error_code == 382004) {
|
||||
$.message.push(`【${name}】:✨今天已签到`);
|
||||
console.log(`【${name}】:${msg_info.errmsg}`);
|
||||
} else {
|
||||
$.message.push(`【${name}】:${msg_info.errmsg}`);
|
||||
console.log(`【${name}】:"发生错误⚠️ 该请求的返回情况如下"`);
|
||||
}
|
||||
} else if (msg_info.hasOwnProperty('result') && msg_info.result == 1) {
|
||||
$.successNum += 1
|
||||
$.message.push(`【${name}】:✅${msg_info.button.name}`)
|
||||
console.log(`【${name}】:${msg_info.button.name}`);
|
||||
} else {
|
||||
$.failNum += 1
|
||||
$.message.push(`【${name}】:发生错误⚠️`);
|
||||
console.log(`【${name}】:"发生错误⚠️ 该请求的返回情况如下"`);
|
||||
console.log(response.body)
|
||||
}
|
||||
} else if ((response.statusCode == 418)) {
|
||||
$.failNum += 1
|
||||
$.message.push(`【${name}】:"签到太频繁啦,请稍后再试"`);
|
||||
console.log(`【${name}】:"签到太频繁啦,请稍后再试"`);
|
||||
} else if (response.statusCode == 511) {
|
||||
$.failNum += 1;
|
||||
$.message.push(`【${name}】:"需要身份验证,请稍后再试"`);
|
||||
console.log(`【${name}】:"需要身份验证,请稍后再试"`);
|
||||
} else {
|
||||
$.failNum += 1
|
||||
$.message.push(`【${name}】:发生错误⚠️`);
|
||||
console.log(`【${name}】:"发生错误⚠️ 该请求的返回情况如下"`);
|
||||
console.log(JSON.stringify(response))
|
||||
}
|
||||
resolve();
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
/*********************************** ENV *************************************/
|
||||
//@Chavy
|
||||
function Env(s) {
|
||||
this.name = s, this.data = null, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.isNode = (() => "undefined" != typeof module && !!module.exports), this.log = ((...s) => {
|
||||
this.logs = [...this.logs, ...s], s ? console.log(s.join("\n")) : console.log(this.logs.join("\n"))
|
||||
}), this.msg = ((s = this.name, t = "", i = "") => {
|
||||
this.isSurge() && $notification.post(s, t, i), this.isQuanX() && $notify(s, t, i);
|
||||
const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
|
||||
s && e.push(s), t && e.push(t), i && e.push(i), console.log(e.join("\n"))
|
||||
}), this.getdata = (s => {
|
||||
if (this.isSurge()) return $persistentStore.read(s);
|
||||
if (this.isQuanX()) return $prefs.valueForKey(s);
|
||||
if (this.isNode()) {
|
||||
const t = "box.dat";
|
||||
return this.fs = this.fs ? this.fs : require("fs"), this.fs.existsSync(t) ? (this.data = JSON.parse(this.fs.readFileSync(t)), this.data[s]) : null
|
||||
}
|
||||
}), this.setdata = ((s, t) => {
|
||||
if (this.isSurge()) return $persistentStore.write(s, t);
|
||||
if (this.isQuanX()) return $prefs.setValueForKey(s, t);
|
||||
if (this.isNode()) {
|
||||
const i = "box.dat";
|
||||
return this.fs = this.fs ? this.fs : require("fs"), !!this.fs.existsSync(i) && (this.data = JSON.parse(this.fs.readFileSync(i)), this.data[t] = s, this.fs.writeFileSync(i, JSON.stringify(this.data)), !0)
|
||||
}
|
||||
}), this.wait = ((s, t = s) => i => setTimeout(() => i(), Math.floor(Math.random() * (t - s + 1) + s))), this.get = ((s, t) => this.send(s, "GET", t)), this.post = ((s, t) => this.send(s, "POST", t)), this.send = ((s, t, i) => {
|
||||
if (this.isSurge()) {
|
||||
const e = "POST" == t ? $httpClient.post : $httpClient.get;
|
||||
e(s, (s, t, e) => {
|
||||
t && (t.body = e, t.statusCode = t.status), i(s, t, e)
|
||||
})
|
||||
}
|
||||
this.isQuanX() && (s.method = t, $task.fetch(s).then(s => {
|
||||
s.status = s.statusCode, i(null, s, s.body)
|
||||
}, s => i(s.error, s, s))), this.isNode() && (this.request = this.request ? this.request : require("request"), s.method = t, s.gzip = !0, this.request(s, (s, t, e) => {
|
||||
t && (t.status = t.statusCode), i(null, t, e)
|
||||
}))
|
||||
}), this.done = ((s = {}) => this.isNode() ? null : $done(s))
|
||||
}
|
||||
/*****************************************************************************/
|
||||
286
Scripts/weibo/weibotalk_signin.js
Normal file
286
Scripts/weibo/weibotalk_signin.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user