@iflyrpa/actions 4.0.3 → 4.0.4-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/searchAccountInfo/getDouyinInfo.d.ts +16 -0
- package/dist/actions/searchAccountInfo/getShipinhaoInfo.d.ts +14 -0
- package/dist/actions/searchAccountInfo/index.d.ts +4 -2
- package/dist/actions/searchAccountInfo/types.d.ts +21 -1
- package/dist/actions/searchPublishInfo/handleDouyinData.d.ts +17 -0
- package/dist/actions/searchPublishInfo/handleShipinhaoData.d.ts +17 -0
- package/dist/actions/searchPublishInfo/index.d.ts +7 -0
- package/dist/actions/searchPublishInfo/types.d.ts +94 -0
- package/dist/actions/weixinPublish/index.d.ts +2 -2
- package/dist/actions/xiaohongshuPublish/index.d.ts +1 -1
- package/dist/bundle.js +1019 -13
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +76 -0
- package/dist/index.js +506 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +506 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4398,9 +4398,7 @@ var __webpack_exports__ = {};
|
|
|
4398
4398
|
});
|
|
4399
4399
|
const package_json_namespaceObject = require("@iflyrpa/share/package.json");
|
|
4400
4400
|
var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
|
|
4401
|
-
var package_namespaceObject = {
|
|
4402
|
-
i8: "4.0.3"
|
|
4403
|
-
};
|
|
4401
|
+
var package_namespaceObject = JSON.parse('{"i8":"4.0.4-beta.1"}');
|
|
4404
4402
|
const share_namespaceObject = require("@iflyrpa/share");
|
|
4405
4403
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
4406
4404
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -15361,6 +15359,199 @@ var __webpack_exports__ = {};
|
|
|
15361
15359
|
};
|
|
15362
15360
|
return (0, share_namespaceObject.success)(bjhData, "百家号平台数据获取成功!");
|
|
15363
15361
|
}
|
|
15362
|
+
async function getDouyinData(_task, params) {
|
|
15363
|
+
try {
|
|
15364
|
+
const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
|
|
15365
|
+
if (!sessionidCookie) return types_errorResponse("抖音账号数据异常,请重新绑定账号后重试。", 414);
|
|
15366
|
+
const csrfToken = params.cookies.find((it)=>"passport_csrf_token" === it.name)?.value || "";
|
|
15367
|
+
const headers = {
|
|
15368
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15369
|
+
referer: "https://creator.douyin.com/creator-micro/home",
|
|
15370
|
+
origin: "https://creator.douyin.com",
|
|
15371
|
+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
|
|
15372
|
+
...csrfToken ? {
|
|
15373
|
+
"x-secsdk-csrf-token": csrfToken
|
|
15374
|
+
} : {}
|
|
15375
|
+
};
|
|
15376
|
+
const args = [
|
|
15377
|
+
{
|
|
15378
|
+
headers
|
|
15379
|
+
},
|
|
15380
|
+
_task.logger,
|
|
15381
|
+
params.proxyLoc,
|
|
15382
|
+
params.localIP,
|
|
15383
|
+
params.accountId
|
|
15384
|
+
];
|
|
15385
|
+
const http = new Http(...args);
|
|
15386
|
+
const toNum = (val)=>{
|
|
15387
|
+
if (null == val) return 0;
|
|
15388
|
+
const n = Number.parseInt(String(val).replace(/[+,]/g, ""), 10);
|
|
15389
|
+
return Number.isNaN(n) ? 0 : n;
|
|
15390
|
+
};
|
|
15391
|
+
const userProfileP = http.api({
|
|
15392
|
+
method: "get",
|
|
15393
|
+
url: "https://www.douyin.com/aweme/v1/web/user/profile/self/",
|
|
15394
|
+
params: {
|
|
15395
|
+
device_platform: "webapp",
|
|
15396
|
+
aid: "6383",
|
|
15397
|
+
channel: "channel_pc_web",
|
|
15398
|
+
pc_client_type: "1",
|
|
15399
|
+
version_code: "170400",
|
|
15400
|
+
version_name: "17.4.0",
|
|
15401
|
+
cookie_enabled: "true",
|
|
15402
|
+
platform: "PC"
|
|
15403
|
+
}
|
|
15404
|
+
}, {
|
|
15405
|
+
retries: 3,
|
|
15406
|
+
retryDelay: 100,
|
|
15407
|
+
timeout: 10000
|
|
15408
|
+
}).catch((e)=>{
|
|
15409
|
+
_task.logger.warn(`抖音用户信息获取失败: ${e instanceof Error ? e.message : String(e)}`);
|
|
15410
|
+
return null;
|
|
15411
|
+
});
|
|
15412
|
+
const overviewP = http.api({
|
|
15413
|
+
method: "get",
|
|
15414
|
+
url: "https://creator.douyin.com/aweme/janus/creator/data/overview/all/",
|
|
15415
|
+
params: {
|
|
15416
|
+
last_days_type: 1,
|
|
15417
|
+
aid: 2906,
|
|
15418
|
+
app_name: "aweme_creator_platform",
|
|
15419
|
+
device_platform: "web"
|
|
15420
|
+
}
|
|
15421
|
+
}, {
|
|
15422
|
+
retries: 3,
|
|
15423
|
+
retryDelay: 100,
|
|
15424
|
+
timeout: 5000
|
|
15425
|
+
}).catch((e)=>{
|
|
15426
|
+
_task.logger.warn(`抖音近7日数据获取失败(可能未开通数据中心或被风控): ${e instanceof Error ? e.message : String(e)}`);
|
|
15427
|
+
return null;
|
|
15428
|
+
});
|
|
15429
|
+
const [userProfile, overview] = await Promise.all([
|
|
15430
|
+
userProfileP,
|
|
15431
|
+
overviewP
|
|
15432
|
+
]);
|
|
15433
|
+
_task.logger.info(`抖音用户信息响应: ${JSON.stringify(userProfile)}`);
|
|
15434
|
+
_task.logger.info(`抖音近7日数据响应: ${JSON.stringify(overview)}`);
|
|
15435
|
+
let fansNum = 0;
|
|
15436
|
+
let favedNum = 0;
|
|
15437
|
+
let followingNum = 0;
|
|
15438
|
+
if (userProfile?.status_code === 0 && userProfile.user) {
|
|
15439
|
+
const user = userProfile.user;
|
|
15440
|
+
fansNum = toNum(user.follower_count);
|
|
15441
|
+
followingNum = toNum(user.following_count);
|
|
15442
|
+
favedNum = toNum(user.total_favorited);
|
|
15443
|
+
_task.logger.info(`提取用户数据 - 昵称: ${user.nickname}, 粉丝: ${fansNum}, 关注: ${followingNum}, 获赞: ${favedNum}, 作品: ${user.aweme_count}`);
|
|
15444
|
+
} else _task.logger.warn(`用户信息接口返回异常: status_code=${userProfile?.status_code}, msg=${userProfile?.status_msg}`);
|
|
15445
|
+
const ov = overview?.data;
|
|
15446
|
+
const douyinData = {
|
|
15447
|
+
fansNum,
|
|
15448
|
+
favedNum,
|
|
15449
|
+
fansNumLastWeek: toNum(ov?.fans_incr?.current_count),
|
|
15450
|
+
watchNumLastWeek: toNum(ov?.play_count?.current_count),
|
|
15451
|
+
likeNumLastWeek: toNum(ov?.like_count?.current_count),
|
|
15452
|
+
commentNumLastWeek: toNum(ov?.comment_count?.current_count),
|
|
15453
|
+
shareNumLastWeek: toNum(ov?.share_count?.current_count),
|
|
15454
|
+
visitNumLastWeek: toNum(ov?.profile_visit?.current_count)
|
|
15455
|
+
};
|
|
15456
|
+
return (0, share_namespaceObject.success)(douyinData, "抖音平台数据获取成功!");
|
|
15457
|
+
} catch (error) {
|
|
15458
|
+
if (error && "object" == typeof error && "code" in error && "message" in error) {
|
|
15459
|
+
const err = error;
|
|
15460
|
+
_task.logger.error(`抖音账号数据获取失败: ${err.message} (${err.code})`);
|
|
15461
|
+
return types_errorResponse(err.message, err.code);
|
|
15462
|
+
}
|
|
15463
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
15464
|
+
_task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
|
|
15465
|
+
return types_errorResponse(errMsg || "抖音账号数据获取失败");
|
|
15466
|
+
}
|
|
15467
|
+
}
|
|
15468
|
+
async function getShipinhaoData(_task, params) {
|
|
15469
|
+
try {
|
|
15470
|
+
const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
|
|
15471
|
+
if (!sessionidCookie) return types_errorResponse("视频号账号数据异常,请重新绑定账号后重试。", 414);
|
|
15472
|
+
const uinCookie = params.cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
|
|
15473
|
+
const deviceIdCookie = params.cookies.find((it)=>"device_id" === it.name || "finger_print_device_id" === it.name)?.value;
|
|
15474
|
+
const aid = params.cookies.find((it)=>"_aid" === it.name)?.value || "9d3e0e9f-b842-498d-a273-4285d58df264";
|
|
15475
|
+
const finderId = params.cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
|
|
15476
|
+
const headers = {
|
|
15477
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
15478
|
+
referer: "https://channels.weixin.qq.com/platform",
|
|
15479
|
+
origin: "https://channels.weixin.qq.com",
|
|
15480
|
+
"content-type": "application/json",
|
|
15481
|
+
"X-WECHAT-UIN": uinCookie,
|
|
15482
|
+
...deviceIdCookie ? {
|
|
15483
|
+
"finger-print-device-id": deviceIdCookie
|
|
15484
|
+
} : {}
|
|
15485
|
+
};
|
|
15486
|
+
const args = [
|
|
15487
|
+
{
|
|
15488
|
+
headers
|
|
15489
|
+
},
|
|
15490
|
+
_task.logger,
|
|
15491
|
+
params.proxyLoc,
|
|
15492
|
+
params.localIP,
|
|
15493
|
+
params.accountId
|
|
15494
|
+
];
|
|
15495
|
+
const http = new Http(...args);
|
|
15496
|
+
const authData = await http.api({
|
|
15497
|
+
method: "post",
|
|
15498
|
+
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/auth/auth_data",
|
|
15499
|
+
params: {
|
|
15500
|
+
_aid: aid,
|
|
15501
|
+
_rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
|
|
15502
|
+
_pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
|
|
15503
|
+
},
|
|
15504
|
+
data: {
|
|
15505
|
+
timestamp: Date.now().toString(),
|
|
15506
|
+
_log_finder_uin: "",
|
|
15507
|
+
_log_finder_id: finderId,
|
|
15508
|
+
rawKeyBuff: "",
|
|
15509
|
+
pluginSessionId: null,
|
|
15510
|
+
scene: 7,
|
|
15511
|
+
reqScene: 7
|
|
15512
|
+
}
|
|
15513
|
+
}, {
|
|
15514
|
+
retries: 3,
|
|
15515
|
+
retryDelay: 100,
|
|
15516
|
+
timeout: 5000
|
|
15517
|
+
});
|
|
15518
|
+
_task.logger.info(`视频号账号数据响应: ${JSON.stringify(authData)}`);
|
|
15519
|
+
const AUTH_ERROR_CODES = [
|
|
15520
|
+
300333,
|
|
15521
|
+
300334,
|
|
15522
|
+
300330,
|
|
15523
|
+
300331,
|
|
15524
|
+
300332
|
|
15525
|
+
];
|
|
15526
|
+
if (authData.errCode && AUTH_ERROR_CODES.includes(authData.errCode)) {
|
|
15527
|
+
_task.logger.warn(`视频号登录已失效:${authData.errMsg} (${authData.errCode})`);
|
|
15528
|
+
return types_errorResponse("视频号账号信息获取失败,请检查账号状态", 414);
|
|
15529
|
+
}
|
|
15530
|
+
if (authData.errCode) {
|
|
15531
|
+
_task.logger.warn(`视频号账号API错误:${authData.errMsg} (${authData.errCode})`);
|
|
15532
|
+
return types_errorResponse(`视频号账号信息获取失败:${authData.errMsg || "未知错误"}`, 414);
|
|
15533
|
+
}
|
|
15534
|
+
const finderUser = authData.data?.finderUser;
|
|
15535
|
+
const shipinhaoData = {
|
|
15536
|
+
fansNum: finderUser?.fansCount || 0,
|
|
15537
|
+
feedsCount: finderUser?.feedsCount || 0,
|
|
15538
|
+
fansNumYesterday: null,
|
|
15539
|
+
playNumYesterday: null,
|
|
15540
|
+
likeNumYesterday: null,
|
|
15541
|
+
commentNumYesterday: null
|
|
15542
|
+
};
|
|
15543
|
+
return (0, share_namespaceObject.success)(shipinhaoData, "视频号平台数据获取成功!");
|
|
15544
|
+
} catch (error) {
|
|
15545
|
+
if (error && "object" == typeof error && "code" in error && "message" in error) {
|
|
15546
|
+
const err = error;
|
|
15547
|
+
_task.logger.error(`视频号账号数据获取失败: ${err.message} (${err.code})`);
|
|
15548
|
+
return types_errorResponse(err.message, err.code);
|
|
15549
|
+
}
|
|
15550
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
15551
|
+
_task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
|
|
15552
|
+
return types_errorResponse(errMsg || "视频号账号数据获取失败");
|
|
15553
|
+
}
|
|
15554
|
+
}
|
|
15364
15555
|
async function getToutiaoData(_task, params) {
|
|
15365
15556
|
const http = new Http({
|
|
15366
15557
|
headers: {
|
|
@@ -15459,7 +15650,7 @@ var __webpack_exports__ = {};
|
|
|
15459
15650
|
userInfoHtmlPromise,
|
|
15460
15651
|
userSummaryHtmlPromise
|
|
15461
15652
|
]);
|
|
15462
|
-
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("
|
|
15653
|
+
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("微信公众号数据获取失败,请检查账号状态", 414);
|
|
15463
15654
|
const userInfoJson = exportWxCgiData(userInfoHtml);
|
|
15464
15655
|
const userSummaryJson = exportWxCgiData(userSummaryHtml);
|
|
15465
15656
|
const wxData = {
|
|
@@ -15536,7 +15727,9 @@ var __webpack_exports__ = {};
|
|
|
15536
15727
|
"toutiao",
|
|
15537
15728
|
"xiaohongshu",
|
|
15538
15729
|
"weixin",
|
|
15539
|
-
"baijiahao"
|
|
15730
|
+
"baijiahao",
|
|
15731
|
+
"douyin",
|
|
15732
|
+
"shipinhao"
|
|
15540
15733
|
])
|
|
15541
15734
|
});
|
|
15542
15735
|
const SearchAccountInfo = async (_task, params)=>{
|
|
@@ -15550,6 +15743,10 @@ var __webpack_exports__ = {};
|
|
|
15550
15743
|
return getWeixinData(_task, params);
|
|
15551
15744
|
case "baijiahao":
|
|
15552
15745
|
return getBaijiahaoData(_task, params);
|
|
15746
|
+
case "douyin":
|
|
15747
|
+
return getDouyinData(_task, params);
|
|
15748
|
+
case "shipinhao":
|
|
15749
|
+
return getShipinhaoData(_task, params);
|
|
15553
15750
|
default:
|
|
15554
15751
|
return (0, share_namespaceObject.success)(null, "暂不支持该平台");
|
|
15555
15752
|
}
|
|
@@ -15644,18 +15841,44 @@ var __webpack_exports__ = {};
|
|
|
15644
15841
|
collectNum: schemas_number(),
|
|
15645
15842
|
shareNum: schemas_number()
|
|
15646
15843
|
});
|
|
15844
|
+
const DouyinArticleSchema = BaseArticleSchema.extend({
|
|
15845
|
+
playNum: schemas_number(),
|
|
15846
|
+
likeNum: schemas_number(),
|
|
15847
|
+
commentNum: schemas_number(),
|
|
15848
|
+
shareNum: schemas_number(),
|
|
15849
|
+
collectNum: schemas_number(),
|
|
15850
|
+
awemeId: schemas_string(),
|
|
15851
|
+
awemeType: schemas_number(),
|
|
15852
|
+
duration: schemas_number().optional(),
|
|
15853
|
+
status: schemas_string(),
|
|
15854
|
+
publicUrl: schemas_string()
|
|
15855
|
+
});
|
|
15856
|
+
const ShipinhaoArticleSchema = BaseArticleSchema.extend({
|
|
15857
|
+
readNum: schemas_number(),
|
|
15858
|
+
likeNum: schemas_number(),
|
|
15859
|
+
commentNum: schemas_number(),
|
|
15860
|
+
forwardNum: schemas_number(),
|
|
15861
|
+
favNum: schemas_number(),
|
|
15862
|
+
objectId: schemas_string(),
|
|
15863
|
+
postType: schemas_string(),
|
|
15864
|
+
postStatus: schemas_number()
|
|
15865
|
+
});
|
|
15647
15866
|
const FetchArticlesDataSchema = schemas_object({
|
|
15648
15867
|
articleCell: schemas_array(union([
|
|
15649
15868
|
ToutiaoArticleSchema,
|
|
15650
15869
|
WeixinArticleSchema,
|
|
15651
15870
|
BaijiahaoArticleSchema,
|
|
15652
|
-
XiaohongshuArticleSchema
|
|
15871
|
+
XiaohongshuArticleSchema,
|
|
15872
|
+
DouyinArticleSchema,
|
|
15873
|
+
ShipinhaoArticleSchema
|
|
15653
15874
|
])).optional(),
|
|
15654
15875
|
timerPublish: schemas_array(union([
|
|
15655
15876
|
ToutiaoArticleSchema,
|
|
15656
15877
|
WeixinArticleSchema,
|
|
15657
15878
|
BaijiahaoArticleSchema,
|
|
15658
|
-
XiaohongshuArticleSchema
|
|
15879
|
+
XiaohongshuArticleSchema,
|
|
15880
|
+
DouyinArticleSchema,
|
|
15881
|
+
ShipinhaoArticleSchema
|
|
15659
15882
|
])).optional(),
|
|
15660
15883
|
pagination: schemas_object({
|
|
15661
15884
|
total: schemas_number().optional(),
|
|
@@ -15770,6 +15993,248 @@ var __webpack_exports__ = {};
|
|
|
15770
15993
|
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
|
|
15771
15994
|
}
|
|
15772
15995
|
}
|
|
15996
|
+
async function handleDouyinData(_task, params) {
|
|
15997
|
+
try {
|
|
15998
|
+
const { cookies, pageNum = 1, pageSize = 12, status = 0, showOriginalData = false, onlySuccess = false } = params;
|
|
15999
|
+
const headers = {
|
|
16000
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
16001
|
+
referer: "https://creator.douyin.com"
|
|
16002
|
+
};
|
|
16003
|
+
const args = [
|
|
16004
|
+
{
|
|
16005
|
+
headers
|
|
16006
|
+
},
|
|
16007
|
+
_task.logger,
|
|
16008
|
+
params.proxyLoc,
|
|
16009
|
+
params.localIP,
|
|
16010
|
+
params.accountId
|
|
16011
|
+
];
|
|
16012
|
+
const http = new Http(...args);
|
|
16013
|
+
async function fetchWorks(cursor) {
|
|
16014
|
+
return await http.api({
|
|
16015
|
+
method: "get",
|
|
16016
|
+
url: "https://creator.douyin.com/janus/douyin/creator/pc/work_list",
|
|
16017
|
+
params: {
|
|
16018
|
+
scene: "star_atlas",
|
|
16019
|
+
device_platform: "android",
|
|
16020
|
+
aid: 1128,
|
|
16021
|
+
status,
|
|
16022
|
+
count: pageSize,
|
|
16023
|
+
max_cursor: cursor
|
|
16024
|
+
}
|
|
16025
|
+
}, {
|
|
16026
|
+
retries: 3,
|
|
16027
|
+
retryDelay: 100,
|
|
16028
|
+
timeout: 5000
|
|
16029
|
+
});
|
|
16030
|
+
}
|
|
16031
|
+
const isHasMore = (v)=>true === v || 1 === v;
|
|
16032
|
+
const skipCount = (pageNum - 1) * pageSize;
|
|
16033
|
+
const needCount = skipCount + pageSize;
|
|
16034
|
+
const workListResponse = await fetchWorks(0);
|
|
16035
|
+
if (!workListResponse || !Array.isArray(workListResponse.aweme_list)) return searchPublishInfo_types_errorResponse("抖音数据获取失败,请检查账号状态", 414);
|
|
16036
|
+
const allWorks = [
|
|
16037
|
+
...workListResponse.aweme_list
|
|
16038
|
+
];
|
|
16039
|
+
let hasMore = isHasMore(workListResponse.has_more);
|
|
16040
|
+
let currentCursor = workListResponse.cursor ?? workListResponse.max_cursor ?? 0;
|
|
16041
|
+
let guard = 0;
|
|
16042
|
+
while(allWorks.length < needCount && hasMore && guard < 20){
|
|
16043
|
+
const nextPageResponse = await fetchWorks(currentCursor);
|
|
16044
|
+
if (!Array.isArray(nextPageResponse.aweme_list) || 0 === nextPageResponse.aweme_list.length) break;
|
|
16045
|
+
allWorks.push(...nextPageResponse.aweme_list);
|
|
16046
|
+
hasMore = isHasMore(nextPageResponse.has_more);
|
|
16047
|
+
currentCursor = nextPageResponse.cursor ?? nextPageResponse.max_cursor ?? currentCursor;
|
|
16048
|
+
guard++;
|
|
16049
|
+
}
|
|
16050
|
+
const finalWorks = allWorks.slice(skipCount, needCount);
|
|
16051
|
+
const articleCell = finalWorks.map((item)=>{
|
|
16052
|
+
const workDetailUrl = `https://creator.douyin.com/creator-micro/work-management/work-detail/${item.aweme_id}`;
|
|
16053
|
+
const workPublicUrl = item.share_url || `https://www.douyin.com/video/${item.aweme_id}`;
|
|
16054
|
+
let statusText;
|
|
16055
|
+
statusText = item.status?.is_delete ? "deleted" : item.status?.is_private ? "private" : item.status?.in_reviewing ? "reviewing" : "public";
|
|
16056
|
+
return {
|
|
16057
|
+
title: item.desc || "无作品描述",
|
|
16058
|
+
imageUrl: item.Cover?.url_list?.[0] || "",
|
|
16059
|
+
createTime: item.create_time,
|
|
16060
|
+
redirectUrl: workDetailUrl,
|
|
16061
|
+
playNum: item.statistics?.play_count || 0,
|
|
16062
|
+
likeNum: item.statistics?.digg_count || 0,
|
|
16063
|
+
commentNum: item.statistics?.comment_count || 0,
|
|
16064
|
+
shareNum: item.statistics?.share_count || 0,
|
|
16065
|
+
collectNum: item.statistics?.collect_count || 0,
|
|
16066
|
+
awemeId: item.aweme_id,
|
|
16067
|
+
awemeType: item.aweme_type ?? 0,
|
|
16068
|
+
duration: item.duration,
|
|
16069
|
+
status: statusText,
|
|
16070
|
+
publicUrl: workPublicUrl,
|
|
16071
|
+
...showOriginalData ? {
|
|
16072
|
+
originalData: item
|
|
16073
|
+
} : {}
|
|
16074
|
+
};
|
|
16075
|
+
});
|
|
16076
|
+
return (0, share_namespaceObject.success)({
|
|
16077
|
+
articleCell,
|
|
16078
|
+
...onlySuccess ? {
|
|
16079
|
+
pagination: {
|
|
16080
|
+
total: workListResponse.total || allWorks.length,
|
|
16081
|
+
nextPage: hasMore,
|
|
16082
|
+
pageNum,
|
|
16083
|
+
pageSize
|
|
16084
|
+
}
|
|
16085
|
+
} : null
|
|
16086
|
+
}, "抖音数据获取成功");
|
|
16087
|
+
} catch (error) {
|
|
16088
|
+
return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "抖音数据获取失败");
|
|
16089
|
+
}
|
|
16090
|
+
}
|
|
16091
|
+
async function handleShipinhaoData(_task, params) {
|
|
16092
|
+
try {
|
|
16093
|
+
const { cookies, postType = "all", pageNum = 1, pageSize = 20, showOriginalData = false } = params;
|
|
16094
|
+
const aidCookie = cookies.find((it)=>"_aid" === it.name)?.value;
|
|
16095
|
+
const aid = aidCookie || "9d3e0e9f-b842-498d-a273-4285d58df264";
|
|
16096
|
+
const uinCookie = cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
|
|
16097
|
+
const deviceIdCookie = cookies.find((it)=>"device_id" === it.name || "finger_print_device_id" === it.name)?.value;
|
|
16098
|
+
const headers = {
|
|
16099
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
16100
|
+
referer: "https://channels.weixin.qq.com",
|
|
16101
|
+
origin: "https://channels.weixin.qq.com",
|
|
16102
|
+
"content-type": "application/json",
|
|
16103
|
+
"X-WECHAT-UIN": uinCookie,
|
|
16104
|
+
...deviceIdCookie ? {
|
|
16105
|
+
"finger-print-device-id": deviceIdCookie
|
|
16106
|
+
} : {}
|
|
16107
|
+
};
|
|
16108
|
+
const args = [
|
|
16109
|
+
{
|
|
16110
|
+
headers
|
|
16111
|
+
},
|
|
16112
|
+
_task.logger,
|
|
16113
|
+
params.proxyLoc,
|
|
16114
|
+
params.localIP,
|
|
16115
|
+
params.accountId
|
|
16116
|
+
];
|
|
16117
|
+
const http = new Http(...args);
|
|
16118
|
+
const finderIdCookie = cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
|
|
16119
|
+
async function fetchPosts(currentPage, userpageType, pageUrl) {
|
|
16120
|
+
return await http.api({
|
|
16121
|
+
method: "post",
|
|
16122
|
+
url: "https://channels.weixin.qq.com/micro/content/cgi-bin/mmfinderassistant-bin/post/post_list",
|
|
16123
|
+
params: {
|
|
16124
|
+
_aid: aid,
|
|
16125
|
+
_rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
|
|
16126
|
+
_pageUrl: encodeURIComponent(pageUrl)
|
|
16127
|
+
},
|
|
16128
|
+
data: {
|
|
16129
|
+
pageSize,
|
|
16130
|
+
currentPage,
|
|
16131
|
+
userpageType,
|
|
16132
|
+
stickyOrder: true,
|
|
16133
|
+
timestamp: Date.now().toString(),
|
|
16134
|
+
_log_finder_uin: "",
|
|
16135
|
+
_log_finder_id: finderIdCookie,
|
|
16136
|
+
rawKeyBuff: "",
|
|
16137
|
+
pluginSessionId: null,
|
|
16138
|
+
scene: 7,
|
|
16139
|
+
reqScene: 7
|
|
16140
|
+
}
|
|
16141
|
+
}, {
|
|
16142
|
+
retries: 3,
|
|
16143
|
+
retryDelay: 100,
|
|
16144
|
+
timeout: 5000
|
|
16145
|
+
});
|
|
16146
|
+
}
|
|
16147
|
+
const mapPost = (item, forcePostType)=>{
|
|
16148
|
+
let imageUrl = "";
|
|
16149
|
+
if (item.desc?.media?.[0]?.thumbUrl) imageUrl = item.desc.media[0].thumbUrl;
|
|
16150
|
+
else if (item.desc?.media?.[0]?.coverUrl) imageUrl = item.desc.media[0].coverUrl;
|
|
16151
|
+
else if (item.cover?.url) imageUrl = item.cover.url;
|
|
16152
|
+
else if (item.media_url) imageUrl = item.media_url;
|
|
16153
|
+
const title = item.desc?.description || item.object_desc || "无标题";
|
|
16154
|
+
return {
|
|
16155
|
+
title,
|
|
16156
|
+
imageUrl,
|
|
16157
|
+
createTime: item.createTime || item.create_time,
|
|
16158
|
+
redirectUrl: "https://channels.weixin.qq.com/platform",
|
|
16159
|
+
readNum: item.readCount || item.read_count || 0,
|
|
16160
|
+
likeNum: item.likeCount || item.like_count || 0,
|
|
16161
|
+
commentNum: item.commentCount || item.comment_count || 0,
|
|
16162
|
+
forwardNum: item.forwardCount || item.forward_count || 0,
|
|
16163
|
+
favNum: item.favCount || item.fav_count || 0,
|
|
16164
|
+
objectId: item.exportId || item.objectId || "",
|
|
16165
|
+
postType: forcePostType,
|
|
16166
|
+
postStatus: item.status || item.post_status || 0,
|
|
16167
|
+
...showOriginalData ? {
|
|
16168
|
+
originalData: item
|
|
16169
|
+
} : {}
|
|
16170
|
+
};
|
|
16171
|
+
};
|
|
16172
|
+
const allArticles = [];
|
|
16173
|
+
const needVideo = "all" === postType || "video" === postType;
|
|
16174
|
+
const needArticle = "all" === postType || "article" === postType;
|
|
16175
|
+
const AUTH_ERROR_CODES = [
|
|
16176
|
+
300333,
|
|
16177
|
+
300334,
|
|
16178
|
+
300330,
|
|
16179
|
+
300331,
|
|
16180
|
+
300332
|
|
16181
|
+
];
|
|
16182
|
+
if (needVideo) try {
|
|
16183
|
+
const videoPageUrl = "https://channels.weixin.qq.com/micro/content/post/list";
|
|
16184
|
+
const videoResponse = await fetchPosts(pageNum, 11, videoPageUrl);
|
|
16185
|
+
_task.logger.info(`视频号视频获取响应:${JSON.stringify(videoResponse)}`);
|
|
16186
|
+
if (videoResponse.errCode && AUTH_ERROR_CODES.includes(videoResponse.errCode)) throw new Error(`AUTH_ERROR:${videoResponse.errMsg || "登录已失效"}`);
|
|
16187
|
+
if (videoResponse.errCode) {
|
|
16188
|
+
_task.logger.warn(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
|
|
16189
|
+
throw new Error(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
|
|
16190
|
+
}
|
|
16191
|
+
{
|
|
16192
|
+
const posts = videoResponse.data?.list || videoResponse.posts || videoResponse.post_list || [];
|
|
16193
|
+
const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
|
|
16194
|
+
allArticles.push(...videoArticles);
|
|
16195
|
+
_task.logger.info(`视频号视频获取成功,共${videoArticles.length}条`);
|
|
16196
|
+
}
|
|
16197
|
+
} catch (error) {
|
|
16198
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
16199
|
+
if (errMsg.startsWith("AUTH_ERROR:")) throw error;
|
|
16200
|
+
_task.logger.warn(`获取视频号视频失败:${errMsg}`);
|
|
16201
|
+
}
|
|
16202
|
+
if (needArticle) try {
|
|
16203
|
+
const articlePageUrl = "https://channels.weixin.qq.com/micro/content/post/finderNewLifePostList";
|
|
16204
|
+
const articleResponse = await fetchPosts(pageNum, 10, articlePageUrl);
|
|
16205
|
+
if (articleResponse.errCode && AUTH_ERROR_CODES.includes(articleResponse.errCode)) throw new Error(`AUTH_ERROR:${articleResponse.errMsg || "登录已失效"}`);
|
|
16206
|
+
if (articleResponse.errCode) {
|
|
16207
|
+
_task.logger.warn(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
|
|
16208
|
+
throw new Error(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
|
|
16209
|
+
}
|
|
16210
|
+
{
|
|
16211
|
+
const posts = articleResponse.data?.list || articleResponse.posts || articleResponse.post_list || [];
|
|
16212
|
+
const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
|
|
16213
|
+
allArticles.push(...articleArticles);
|
|
16214
|
+
_task.logger.info(`视频号图文获取成功,共${articleArticles.length}条`);
|
|
16215
|
+
}
|
|
16216
|
+
} catch (error) {
|
|
16217
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
16218
|
+
if (errMsg.startsWith("AUTH_ERROR:")) throw error;
|
|
16219
|
+
_task.logger.warn(`获取视频号图文失败:${errMsg}`);
|
|
16220
|
+
}
|
|
16221
|
+
allArticles.sort((a, b)=>b.createTime - a.createTime);
|
|
16222
|
+
_task.logger.info(`视频号数据获取成功,${JSON.stringify(allArticles)}`);
|
|
16223
|
+
return (0, share_namespaceObject.success)({
|
|
16224
|
+
articleCell: allArticles,
|
|
16225
|
+
pagination: {
|
|
16226
|
+
total: allArticles.length,
|
|
16227
|
+
nextPage: false,
|
|
16228
|
+
pageNum,
|
|
16229
|
+
pageSize
|
|
16230
|
+
}
|
|
16231
|
+
}, "视频号数据获取成功");
|
|
16232
|
+
} catch (error) {
|
|
16233
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
16234
|
+
if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
|
|
16235
|
+
return searchPublishInfo_types_errorResponse(errMsg || "视频号数据获取失败");
|
|
16236
|
+
}
|
|
16237
|
+
}
|
|
15773
16238
|
async function handleToutiaoData(_task, params) {
|
|
15774
16239
|
try {
|
|
15775
16240
|
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, containsArticle = false } = params;
|
|
@@ -15802,7 +16267,7 @@ var __webpack_exports__ = {};
|
|
|
15802
16267
|
app_id: 1231
|
|
15803
16268
|
}
|
|
15804
16269
|
});
|
|
15805
|
-
if (0 !== visitedUid.code) return searchPublishInfo_types_errorResponse("
|
|
16270
|
+
if (0 !== visitedUid.code) return searchPublishInfo_types_errorResponse("头条号数据获取失败,请检查账号状态", 414);
|
|
15806
16271
|
const articleInfo = await http.api({
|
|
15807
16272
|
method: "get",
|
|
15808
16273
|
url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
|
|
@@ -15911,7 +16376,7 @@ var __webpack_exports__ = {};
|
|
|
15911
16376
|
const size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
|
|
15912
16377
|
let begin = (lastPage ?? pageNum) - 1;
|
|
15913
16378
|
const rawArticlesInfo = await fetchArticles(begin * size, size, token);
|
|
15914
|
-
if (rawArticlesInfo.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return searchPublishInfo_types_errorResponse("
|
|
16379
|
+
if (rawArticlesInfo.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return searchPublishInfo_types_errorResponse("微信公众号数据获取失败,请检查账号状态", 414);
|
|
15915
16380
|
const articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
15916
16381
|
let articleCell = [];
|
|
15917
16382
|
if (!onlySuccess && pageSize > 20) {
|
|
@@ -16073,7 +16538,7 @@ var __webpack_exports__ = {};
|
|
|
16073
16538
|
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
16074
16539
|
if (!a1Cookie) return {
|
|
16075
16540
|
code: 414,
|
|
16076
|
-
message: "
|
|
16541
|
+
message: "小红书数据获取失败,请检查账号状态",
|
|
16077
16542
|
data: {}
|
|
16078
16543
|
};
|
|
16079
16544
|
if (onlySuccess && 10 !== pageSize) return {
|
|
@@ -16192,7 +16657,7 @@ var __webpack_exports__ = {};
|
|
|
16192
16657
|
}, "小红书文章数据获取成功");
|
|
16193
16658
|
}
|
|
16194
16659
|
const FetchArticlesParamsSchema = ActionCommonParamsSchema.extend({
|
|
16195
|
-
platform: schemas_string().describe("社交平台:weixin, toutiao, baijiahao, xiaohongshu"),
|
|
16660
|
+
platform: schemas_string().describe("社交平台:weixin, toutiao, baijiahao, xiaohongshu, douyin, shipinhao"),
|
|
16196
16661
|
token: union([
|
|
16197
16662
|
schemas_string(),
|
|
16198
16663
|
schemas_number()
|
|
@@ -16204,7 +16669,14 @@ var __webpack_exports__ = {};
|
|
|
16204
16669
|
showOriginalData: schemas_boolean().optional().describe("是否展示原始数据,默认false"),
|
|
16205
16670
|
cursor: schemas_number().optional().describe("仅用于微信分页游标,默认为空"),
|
|
16206
16671
|
lastPage: schemas_number().optional(),
|
|
16207
|
-
containsArticle: schemas_boolean().optional().describe("是否包含文章内容,默认false")
|
|
16672
|
+
containsArticle: schemas_boolean().optional().describe("是否包含文章内容,默认false"),
|
|
16673
|
+
status: schemas_number().optional().describe("抖音作品状态:0=全部"),
|
|
16674
|
+
includeAccount: schemas_boolean().optional().describe("是否包含账号数据,默认true"),
|
|
16675
|
+
postType: schemas_enum([
|
|
16676
|
+
"video",
|
|
16677
|
+
"article",
|
|
16678
|
+
"all"
|
|
16679
|
+
]).optional().describe("视频号作品类型:video=视频, article=图文, all=全部")
|
|
16208
16680
|
});
|
|
16209
16681
|
const FetchArticles = async (_task, params)=>{
|
|
16210
16682
|
const { platform } = params;
|
|
@@ -16217,6 +16689,10 @@ var __webpack_exports__ = {};
|
|
|
16217
16689
|
return handleBaijiahaoData(_task, params);
|
|
16218
16690
|
case "xiaohongshu":
|
|
16219
16691
|
return handleXiaohongshuData(_task, params);
|
|
16692
|
+
case "douyin":
|
|
16693
|
+
return handleDouyinData(_task, params);
|
|
16694
|
+
case "shipinhao":
|
|
16695
|
+
return handleShipinhaoData(_task, params);
|
|
16220
16696
|
default:
|
|
16221
16697
|
return (0, share_namespaceObject.success)({}, "暂不支持该平台");
|
|
16222
16698
|
}
|
|
@@ -24782,6 +25258,24 @@ var __webpack_exports__ = {};
|
|
|
24782
25258
|
likeNumYesterday: schemas_number().nullable(),
|
|
24783
25259
|
commentNumYesterday: schemas_number().nullable()
|
|
24784
25260
|
});
|
|
25261
|
+
schemas_object({
|
|
25262
|
+
fansNum: schemas_number(),
|
|
25263
|
+
favedNum: schemas_number(),
|
|
25264
|
+
fansNumLastWeek: schemas_number(),
|
|
25265
|
+
watchNumLastWeek: schemas_number(),
|
|
25266
|
+
likeNumLastWeek: schemas_number(),
|
|
25267
|
+
commentNumLastWeek: schemas_number(),
|
|
25268
|
+
shareNumLastWeek: schemas_number(),
|
|
25269
|
+
visitNumLastWeek: schemas_number()
|
|
25270
|
+
});
|
|
25271
|
+
schemas_object({
|
|
25272
|
+
fansNum: schemas_number(),
|
|
25273
|
+
feedsCount: schemas_number(),
|
|
25274
|
+
fansNumYesterday: schemas_number().nullable(),
|
|
25275
|
+
playNumYesterday: schemas_number().nullable(),
|
|
25276
|
+
likeNumYesterday: schemas_number().nullable(),
|
|
25277
|
+
commentNumYesterday: schemas_number().nullable()
|
|
25278
|
+
});
|
|
24785
25279
|
const BetaFlag = "HuiwenCanary";
|
|
24786
25280
|
class Action {
|
|
24787
25281
|
constructor(task){
|