@iflyrpa/actions 4.0.4-beta.0 → 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/bundle.js +256 -38
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +256 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +256 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AutomateTask } from "@iflyrpa/share";
|
|
2
|
+
import type { SearchAccountInfoParams } from ".";
|
|
3
|
+
import { type SearchAccountInfoResponse } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* 抖音账号数据采集
|
|
6
|
+
*
|
|
7
|
+
* 核心接口:
|
|
8
|
+
* 1. 用户完整信息: GET /aweme/v1/web/user/profile/self/
|
|
9
|
+
* 返回 user.follower_count(粉丝)、user.following_count(关注)、user.total_favorited(获赞)等
|
|
10
|
+
* 2. 近7日数据概览: GET /aweme/janus/creator/data/overview/all/?last_days_type=1
|
|
11
|
+
*
|
|
12
|
+
* 注意: 近7日数据接口需要 msToken / a_bogus 动态参数,
|
|
13
|
+
* 建议通过 Playwright 复用已登录浏览器上下文请求(详见文档 3.2)。
|
|
14
|
+
* 此处直接请求,若被风控拦截会返回对应错误,昨日/近7日数据降级为 0。
|
|
15
|
+
*/
|
|
16
|
+
export declare function getDouyinData(_task: AutomateTask, params: SearchAccountInfoParams): Promise<SearchAccountInfoResponse>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AutomateTask } from "@iflyrpa/share";
|
|
2
|
+
import type { SearchAccountInfoParams } from ".";
|
|
3
|
+
import { type SearchAccountInfoResponse } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* 视频号账号数据采集
|
|
6
|
+
*
|
|
7
|
+
* 参考《API接口文档-抖音和视频号数据采集》 2.1:
|
|
8
|
+
* POST /cgi-bin/mmfinderassistant-bin/auth/auth_data
|
|
9
|
+
*
|
|
10
|
+
* auth_data 返回账号基础信息(粉丝数、作品数)。
|
|
11
|
+
* 昨日数据(净增关注/新增播放/喜欢/评论)需调用专门的统计接口,
|
|
12
|
+
* auth_data 本身不返回,因此这些字段降级为 null。
|
|
13
|
+
*/
|
|
14
|
+
export declare function getShipinhaoData(_task: AutomateTask, params: SearchAccountInfoParams): Promise<SearchAccountInfoResponse>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CommonAction } from "@iflyrpa/share";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { bjhConfigData, ttConfigData, wxConfigData, xhsConfigData } from "./types";
|
|
3
|
+
import { bjhConfigData, douyinConfigData, shipinhaoConfigData, ttConfigData, wxConfigData, xhsConfigData } from "./types";
|
|
4
4
|
export declare const SearchAccountInfoParamsSchema: z.ZodObject<{
|
|
5
5
|
id: z.ZodOptional<z.ZodString>;
|
|
6
6
|
userAgent: z.ZodOptional<z.ZodString>;
|
|
@@ -38,10 +38,12 @@ export declare const SearchAccountInfoParamsSchema: z.ZodObject<{
|
|
|
38
38
|
token: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
39
39
|
platform: z.ZodEnum<{
|
|
40
40
|
baijiahao: "baijiahao";
|
|
41
|
+
douyin: "douyin";
|
|
41
42
|
toutiao: "toutiao";
|
|
42
43
|
xiaohongshu: "xiaohongshu";
|
|
43
44
|
weixin: "weixin";
|
|
45
|
+
shipinhao: "shipinhao";
|
|
44
46
|
}>;
|
|
45
47
|
}, z.core.$strip>;
|
|
46
48
|
export type SearchAccountInfoParams = z.infer<typeof SearchAccountInfoParamsSchema>;
|
|
47
|
-
export declare const SearchAccountInfo: CommonAction<SearchAccountInfoParams, ttConfigData | xhsConfigData | wxConfigData | bjhConfigData | null>;
|
|
49
|
+
export declare const SearchAccountInfo: CommonAction<SearchAccountInfoParams, ttConfigData | xhsConfigData | wxConfigData | bjhConfigData | douyinConfigData | shipinhaoConfigData | null>;
|
|
@@ -41,8 +41,28 @@ export declare const bjhConfigDataSchema: z.ZodObject<{
|
|
|
41
41
|
commentNumYesterday: z.ZodNullable<z.ZodNumber>;
|
|
42
42
|
}, z.core.$strip>;
|
|
43
43
|
export type bjhConfigData = z.infer<typeof bjhConfigDataSchema>;
|
|
44
|
+
export declare const douyinConfigDataSchema: z.ZodObject<{
|
|
45
|
+
fansNum: z.ZodNumber;
|
|
46
|
+
favedNum: z.ZodNumber;
|
|
47
|
+
fansNumLastWeek: z.ZodNumber;
|
|
48
|
+
watchNumLastWeek: z.ZodNumber;
|
|
49
|
+
likeNumLastWeek: z.ZodNumber;
|
|
50
|
+
commentNumLastWeek: z.ZodNumber;
|
|
51
|
+
shareNumLastWeek: z.ZodNumber;
|
|
52
|
+
visitNumLastWeek: z.ZodNumber;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type douyinConfigData = z.infer<typeof douyinConfigDataSchema>;
|
|
55
|
+
export declare const shipinhaoConfigDataSchema: z.ZodObject<{
|
|
56
|
+
fansNum: z.ZodNumber;
|
|
57
|
+
feedsCount: z.ZodNumber;
|
|
58
|
+
fansNumYesterday: z.ZodNullable<z.ZodNumber>;
|
|
59
|
+
playNumYesterday: z.ZodNullable<z.ZodNumber>;
|
|
60
|
+
likeNumYesterday: z.ZodNullable<z.ZodNumber>;
|
|
61
|
+
commentNumYesterday: z.ZodNullable<z.ZodNumber>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type shipinhaoConfigData = z.infer<typeof shipinhaoConfigDataSchema>;
|
|
44
64
|
export interface SearchAccountInfoResponse {
|
|
45
65
|
code: number;
|
|
46
66
|
message: string;
|
|
47
|
-
data: ttConfigData | xhsConfigData | wxConfigData | bjhConfigData | null;
|
|
67
|
+
data: ttConfigData | xhsConfigData | wxConfigData | bjhConfigData | douyinConfigData | shipinhaoConfigData | null;
|
|
48
68
|
}
|
package/dist/bundle.js
CHANGED
|
@@ -12488,7 +12488,7 @@ var __webpack_exports__ = {};
|
|
|
12488
12488
|
var package_namespaceObject = {
|
|
12489
12489
|
i8: "0.1.2"
|
|
12490
12490
|
};
|
|
12491
|
-
var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.4-beta.
|
|
12491
|
+
var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.4-beta.1"}');
|
|
12492
12492
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
12493
12493
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
12494
12494
|
const external_node_http_namespaceObject = require("node:http");
|
|
@@ -40430,6 +40430,199 @@ var __webpack_exports__ = {};
|
|
|
40430
40430
|
};
|
|
40431
40431
|
return success(bjhData, "百家号平台数据获取成功!");
|
|
40432
40432
|
}
|
|
40433
|
+
async function getDouyinData(_task, params) {
|
|
40434
|
+
try {
|
|
40435
|
+
const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
|
|
40436
|
+
if (!sessionidCookie) return types_errorResponse("抖音账号数据异常,请重新绑定账号后重试。", 414);
|
|
40437
|
+
const csrfToken = params.cookies.find((it)=>"passport_csrf_token" === it.name)?.value || "";
|
|
40438
|
+
const headers = {
|
|
40439
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
40440
|
+
referer: "https://creator.douyin.com/creator-micro/home",
|
|
40441
|
+
origin: "https://creator.douyin.com",
|
|
40442
|
+
"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",
|
|
40443
|
+
...csrfToken ? {
|
|
40444
|
+
"x-secsdk-csrf-token": csrfToken
|
|
40445
|
+
} : {}
|
|
40446
|
+
};
|
|
40447
|
+
const args = [
|
|
40448
|
+
{
|
|
40449
|
+
headers
|
|
40450
|
+
},
|
|
40451
|
+
_task.logger,
|
|
40452
|
+
params.proxyLoc,
|
|
40453
|
+
params.localIP,
|
|
40454
|
+
params.accountId
|
|
40455
|
+
];
|
|
40456
|
+
const http = new Http(...args);
|
|
40457
|
+
const toNum = (val)=>{
|
|
40458
|
+
if (null == val) return 0;
|
|
40459
|
+
const n = Number.parseInt(String(val).replace(/[+,]/g, ""), 10);
|
|
40460
|
+
return Number.isNaN(n) ? 0 : n;
|
|
40461
|
+
};
|
|
40462
|
+
const userProfileP = http.api({
|
|
40463
|
+
method: "get",
|
|
40464
|
+
url: "https://www.douyin.com/aweme/v1/web/user/profile/self/",
|
|
40465
|
+
params: {
|
|
40466
|
+
device_platform: "webapp",
|
|
40467
|
+
aid: "6383",
|
|
40468
|
+
channel: "channel_pc_web",
|
|
40469
|
+
pc_client_type: "1",
|
|
40470
|
+
version_code: "170400",
|
|
40471
|
+
version_name: "17.4.0",
|
|
40472
|
+
cookie_enabled: "true",
|
|
40473
|
+
platform: "PC"
|
|
40474
|
+
}
|
|
40475
|
+
}, {
|
|
40476
|
+
retries: 3,
|
|
40477
|
+
retryDelay: 100,
|
|
40478
|
+
timeout: 10000
|
|
40479
|
+
}).catch((e)=>{
|
|
40480
|
+
_task.logger.warn(`抖音用户信息获取失败: ${e instanceof Error ? e.message : String(e)}`);
|
|
40481
|
+
return null;
|
|
40482
|
+
});
|
|
40483
|
+
const overviewP = http.api({
|
|
40484
|
+
method: "get",
|
|
40485
|
+
url: "https://creator.douyin.com/aweme/janus/creator/data/overview/all/",
|
|
40486
|
+
params: {
|
|
40487
|
+
last_days_type: 1,
|
|
40488
|
+
aid: 2906,
|
|
40489
|
+
app_name: "aweme_creator_platform",
|
|
40490
|
+
device_platform: "web"
|
|
40491
|
+
}
|
|
40492
|
+
}, {
|
|
40493
|
+
retries: 3,
|
|
40494
|
+
retryDelay: 100,
|
|
40495
|
+
timeout: 5000
|
|
40496
|
+
}).catch((e)=>{
|
|
40497
|
+
_task.logger.warn(`抖音近7日数据获取失败(可能未开通数据中心或被风控): ${e instanceof Error ? e.message : String(e)}`);
|
|
40498
|
+
return null;
|
|
40499
|
+
});
|
|
40500
|
+
const [userProfile, overview] = await Promise.all([
|
|
40501
|
+
userProfileP,
|
|
40502
|
+
overviewP
|
|
40503
|
+
]);
|
|
40504
|
+
_task.logger.info(`抖音用户信息响应: ${JSON.stringify(userProfile)}`);
|
|
40505
|
+
_task.logger.info(`抖音近7日数据响应: ${JSON.stringify(overview)}`);
|
|
40506
|
+
let fansNum = 0;
|
|
40507
|
+
let favedNum = 0;
|
|
40508
|
+
let followingNum = 0;
|
|
40509
|
+
if (userProfile?.status_code === 0 && userProfile.user) {
|
|
40510
|
+
const user = userProfile.user;
|
|
40511
|
+
fansNum = toNum(user.follower_count);
|
|
40512
|
+
followingNum = toNum(user.following_count);
|
|
40513
|
+
favedNum = toNum(user.total_favorited);
|
|
40514
|
+
_task.logger.info(`提取用户数据 - 昵称: ${user.nickname}, 粉丝: ${fansNum}, 关注: ${followingNum}, 获赞: ${favedNum}, 作品: ${user.aweme_count}`);
|
|
40515
|
+
} else _task.logger.warn(`用户信息接口返回异常: status_code=${userProfile?.status_code}, msg=${userProfile?.status_msg}`);
|
|
40516
|
+
const ov = overview?.data;
|
|
40517
|
+
const douyinData = {
|
|
40518
|
+
fansNum,
|
|
40519
|
+
favedNum,
|
|
40520
|
+
fansNumLastWeek: toNum(ov?.fans_incr?.current_count),
|
|
40521
|
+
watchNumLastWeek: toNum(ov?.play_count?.current_count),
|
|
40522
|
+
likeNumLastWeek: toNum(ov?.like_count?.current_count),
|
|
40523
|
+
commentNumLastWeek: toNum(ov?.comment_count?.current_count),
|
|
40524
|
+
shareNumLastWeek: toNum(ov?.share_count?.current_count),
|
|
40525
|
+
visitNumLastWeek: toNum(ov?.profile_visit?.current_count)
|
|
40526
|
+
};
|
|
40527
|
+
return success(douyinData, "抖音平台数据获取成功!");
|
|
40528
|
+
} catch (error) {
|
|
40529
|
+
if (error && "object" == typeof error && "code" in error && "message" in error) {
|
|
40530
|
+
const err = error;
|
|
40531
|
+
_task.logger.error(`抖音账号数据获取失败: ${err.message} (${err.code})`);
|
|
40532
|
+
return types_errorResponse(err.message, err.code);
|
|
40533
|
+
}
|
|
40534
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
40535
|
+
_task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
|
|
40536
|
+
return types_errorResponse(errMsg || "抖音账号数据获取失败");
|
|
40537
|
+
}
|
|
40538
|
+
}
|
|
40539
|
+
async function getShipinhaoData(_task, params) {
|
|
40540
|
+
try {
|
|
40541
|
+
const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
|
|
40542
|
+
if (!sessionidCookie) return types_errorResponse("视频号账号数据异常,请重新绑定账号后重试。", 414);
|
|
40543
|
+
const uinCookie = params.cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
|
|
40544
|
+
const deviceIdCookie = params.cookies.find((it)=>"device_id" === it.name || "finger_print_device_id" === it.name)?.value;
|
|
40545
|
+
const aid = params.cookies.find((it)=>"_aid" === it.name)?.value || "9d3e0e9f-b842-498d-a273-4285d58df264";
|
|
40546
|
+
const finderId = params.cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
|
|
40547
|
+
const headers = {
|
|
40548
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
40549
|
+
referer: "https://channels.weixin.qq.com/platform",
|
|
40550
|
+
origin: "https://channels.weixin.qq.com",
|
|
40551
|
+
"content-type": "application/json",
|
|
40552
|
+
"X-WECHAT-UIN": uinCookie,
|
|
40553
|
+
...deviceIdCookie ? {
|
|
40554
|
+
"finger-print-device-id": deviceIdCookie
|
|
40555
|
+
} : {}
|
|
40556
|
+
};
|
|
40557
|
+
const args = [
|
|
40558
|
+
{
|
|
40559
|
+
headers
|
|
40560
|
+
},
|
|
40561
|
+
_task.logger,
|
|
40562
|
+
params.proxyLoc,
|
|
40563
|
+
params.localIP,
|
|
40564
|
+
params.accountId
|
|
40565
|
+
];
|
|
40566
|
+
const http = new Http(...args);
|
|
40567
|
+
const authData = await http.api({
|
|
40568
|
+
method: "post",
|
|
40569
|
+
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/auth/auth_data",
|
|
40570
|
+
params: {
|
|
40571
|
+
_aid: aid,
|
|
40572
|
+
_rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
|
|
40573
|
+
_pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
|
|
40574
|
+
},
|
|
40575
|
+
data: {
|
|
40576
|
+
timestamp: Date.now().toString(),
|
|
40577
|
+
_log_finder_uin: "",
|
|
40578
|
+
_log_finder_id: finderId,
|
|
40579
|
+
rawKeyBuff: "",
|
|
40580
|
+
pluginSessionId: null,
|
|
40581
|
+
scene: 7,
|
|
40582
|
+
reqScene: 7
|
|
40583
|
+
}
|
|
40584
|
+
}, {
|
|
40585
|
+
retries: 3,
|
|
40586
|
+
retryDelay: 100,
|
|
40587
|
+
timeout: 5000
|
|
40588
|
+
});
|
|
40589
|
+
_task.logger.info(`视频号账号数据响应: ${JSON.stringify(authData)}`);
|
|
40590
|
+
const AUTH_ERROR_CODES = [
|
|
40591
|
+
300333,
|
|
40592
|
+
300334,
|
|
40593
|
+
300330,
|
|
40594
|
+
300331,
|
|
40595
|
+
300332
|
|
40596
|
+
];
|
|
40597
|
+
if (authData.errCode && AUTH_ERROR_CODES.includes(authData.errCode)) {
|
|
40598
|
+
_task.logger.warn(`视频号登录已失效:${authData.errMsg} (${authData.errCode})`);
|
|
40599
|
+
return types_errorResponse("视频号账号信息获取失败,请检查账号状态", 414);
|
|
40600
|
+
}
|
|
40601
|
+
if (authData.errCode) {
|
|
40602
|
+
_task.logger.warn(`视频号账号API错误:${authData.errMsg} (${authData.errCode})`);
|
|
40603
|
+
return types_errorResponse(`视频号账号信息获取失败:${authData.errMsg || "未知错误"}`, 414);
|
|
40604
|
+
}
|
|
40605
|
+
const finderUser = authData.data?.finderUser;
|
|
40606
|
+
const shipinhaoData = {
|
|
40607
|
+
fansNum: finderUser?.fansCount || 0,
|
|
40608
|
+
feedsCount: finderUser?.feedsCount || 0,
|
|
40609
|
+
fansNumYesterday: null,
|
|
40610
|
+
playNumYesterday: null,
|
|
40611
|
+
likeNumYesterday: null,
|
|
40612
|
+
commentNumYesterday: null
|
|
40613
|
+
};
|
|
40614
|
+
return success(shipinhaoData, "视频号平台数据获取成功!");
|
|
40615
|
+
} catch (error) {
|
|
40616
|
+
if (error && "object" == typeof error && "code" in error && "message" in error) {
|
|
40617
|
+
const err = error;
|
|
40618
|
+
_task.logger.error(`视频号账号数据获取失败: ${err.message} (${err.code})`);
|
|
40619
|
+
return types_errorResponse(err.message, err.code);
|
|
40620
|
+
}
|
|
40621
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
40622
|
+
_task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
|
|
40623
|
+
return types_errorResponse(errMsg || "视频号账号数据获取失败");
|
|
40624
|
+
}
|
|
40625
|
+
}
|
|
40433
40626
|
async function getToutiaoData(_task, params) {
|
|
40434
40627
|
const http = new Http({
|
|
40435
40628
|
headers: {
|
|
@@ -40528,7 +40721,7 @@ var __webpack_exports__ = {};
|
|
|
40528
40721
|
userInfoHtmlPromise,
|
|
40529
40722
|
userSummaryHtmlPromise
|
|
40530
40723
|
]);
|
|
40531
|
-
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("
|
|
40724
|
+
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("微信公众号数据获取失败,请检查账号状态", 414);
|
|
40532
40725
|
const userInfoJson = exportWxCgiData(userInfoHtml);
|
|
40533
40726
|
const userSummaryJson = exportWxCgiData(userSummaryHtml);
|
|
40534
40727
|
const wxData = {
|
|
@@ -40605,7 +40798,9 @@ var __webpack_exports__ = {};
|
|
|
40605
40798
|
"toutiao",
|
|
40606
40799
|
"xiaohongshu",
|
|
40607
40800
|
"weixin",
|
|
40608
|
-
"baijiahao"
|
|
40801
|
+
"baijiahao",
|
|
40802
|
+
"douyin",
|
|
40803
|
+
"shipinhao"
|
|
40609
40804
|
])
|
|
40610
40805
|
});
|
|
40611
40806
|
const SearchAccountInfo = async (_task, params)=>{
|
|
@@ -40619,6 +40814,10 @@ var __webpack_exports__ = {};
|
|
|
40619
40814
|
return getWeixinData(_task, params);
|
|
40620
40815
|
case "baijiahao":
|
|
40621
40816
|
return getBaijiahaoData(_task, params);
|
|
40817
|
+
case "douyin":
|
|
40818
|
+
return getDouyinData(_task, params);
|
|
40819
|
+
case "shipinhao":
|
|
40820
|
+
return getShipinhaoData(_task, params);
|
|
40622
40821
|
default:
|
|
40623
40822
|
return success(null, "暂不支持该平台");
|
|
40624
40823
|
}
|
|
@@ -40882,21 +41081,6 @@ var __webpack_exports__ = {};
|
|
|
40882
41081
|
params.accountId
|
|
40883
41082
|
];
|
|
40884
41083
|
const http = new Http(...args);
|
|
40885
|
-
let authorUid = "";
|
|
40886
|
-
try {
|
|
40887
|
-
const userInfo = await http.api({
|
|
40888
|
-
method: "get",
|
|
40889
|
-
url: "https://creator.douyin.com/aweme/v1/creator/user/info/"
|
|
40890
|
-
}, {
|
|
40891
|
-
retries: 3,
|
|
40892
|
-
retryDelay: 100,
|
|
40893
|
-
timeout: 5000
|
|
40894
|
-
});
|
|
40895
|
-
authorUid = userInfo.user_profile?.unique_id || "";
|
|
40896
|
-
if (!userInfo.has_data_mgmt_perm) _task.logger.warn("抖音账号未开通数据中心权限,近7日数据不可用");
|
|
40897
|
-
} catch (error) {
|
|
40898
|
-
_task.logger.warn("获取抖音用户信息失败");
|
|
40899
|
-
}
|
|
40900
41084
|
async function fetchWorks(cursor) {
|
|
40901
41085
|
return await http.api({
|
|
40902
41086
|
method: "get",
|
|
@@ -40915,25 +41099,31 @@ var __webpack_exports__ = {};
|
|
|
40915
41099
|
timeout: 5000
|
|
40916
41100
|
});
|
|
40917
41101
|
}
|
|
40918
|
-
const
|
|
40919
|
-
const
|
|
40920
|
-
|
|
41102
|
+
const isHasMore = (v)=>true === v || 1 === v;
|
|
41103
|
+
const skipCount = (pageNum - 1) * pageSize;
|
|
41104
|
+
const needCount = skipCount + pageSize;
|
|
41105
|
+
const workListResponse = await fetchWorks(0);
|
|
41106
|
+
if (!workListResponse || !Array.isArray(workListResponse.aweme_list)) return searchPublishInfo_types_errorResponse("抖音数据获取失败,请检查账号状态", 414);
|
|
40921
41107
|
const allWorks = [
|
|
40922
41108
|
...workListResponse.aweme_list
|
|
40923
41109
|
];
|
|
40924
|
-
let hasMore = workListResponse.has_more;
|
|
40925
|
-
let currentCursor = workListResponse.max_cursor;
|
|
40926
|
-
|
|
41110
|
+
let hasMore = isHasMore(workListResponse.has_more);
|
|
41111
|
+
let currentCursor = workListResponse.cursor ?? workListResponse.max_cursor ?? 0;
|
|
41112
|
+
let guard = 0;
|
|
41113
|
+
while(allWorks.length < needCount && hasMore && guard < 20){
|
|
40927
41114
|
const nextPageResponse = await fetchWorks(currentCursor);
|
|
41115
|
+
if (!Array.isArray(nextPageResponse.aweme_list) || 0 === nextPageResponse.aweme_list.length) break;
|
|
40928
41116
|
allWorks.push(...nextPageResponse.aweme_list);
|
|
40929
|
-
hasMore = nextPageResponse.has_more;
|
|
40930
|
-
currentCursor = nextPageResponse.max_cursor;
|
|
40931
|
-
|
|
41117
|
+
hasMore = isHasMore(nextPageResponse.has_more);
|
|
41118
|
+
currentCursor = nextPageResponse.cursor ?? nextPageResponse.max_cursor ?? currentCursor;
|
|
41119
|
+
guard++;
|
|
40932
41120
|
}
|
|
40933
|
-
const finalWorks = allWorks.slice(
|
|
41121
|
+
const finalWorks = allWorks.slice(skipCount, needCount);
|
|
40934
41122
|
const articleCell = finalWorks.map((item)=>{
|
|
40935
41123
|
const workDetailUrl = `https://creator.douyin.com/creator-micro/work-management/work-detail/${item.aweme_id}`;
|
|
40936
|
-
const workPublicUrl =
|
|
41124
|
+
const workPublicUrl = item.share_url || `https://www.douyin.com/video/${item.aweme_id}`;
|
|
41125
|
+
let statusText;
|
|
41126
|
+
statusText = item.status?.is_delete ? "deleted" : item.status?.is_private ? "private" : item.status?.in_reviewing ? "reviewing" : "public";
|
|
40937
41127
|
return {
|
|
40938
41128
|
title: item.desc || "无作品描述",
|
|
40939
41129
|
imageUrl: item.Cover?.url_list?.[0] || "",
|
|
@@ -40945,9 +41135,9 @@ var __webpack_exports__ = {};
|
|
|
40945
41135
|
shareNum: item.statistics?.share_count || 0,
|
|
40946
41136
|
collectNum: item.statistics?.collect_count || 0,
|
|
40947
41137
|
awemeId: item.aweme_id,
|
|
40948
|
-
awemeType: item.aweme_type,
|
|
41138
|
+
awemeType: item.aweme_type ?? 0,
|
|
40949
41139
|
duration: item.duration,
|
|
40950
|
-
status:
|
|
41140
|
+
status: statusText,
|
|
40951
41141
|
publicUrl: workPublicUrl,
|
|
40952
41142
|
...showOriginalData ? {
|
|
40953
41143
|
originalData: item
|
|
@@ -40958,8 +41148,8 @@ var __webpack_exports__ = {};
|
|
|
40958
41148
|
articleCell,
|
|
40959
41149
|
...onlySuccess ? {
|
|
40960
41150
|
pagination: {
|
|
40961
|
-
total: workListResponse.total ||
|
|
40962
|
-
nextPage:
|
|
41151
|
+
total: workListResponse.total || allWorks.length,
|
|
41152
|
+
nextPage: hasMore,
|
|
40963
41153
|
pageNum,
|
|
40964
41154
|
pageSize
|
|
40965
41155
|
}
|
|
@@ -41055,14 +41245,21 @@ var __webpack_exports__ = {};
|
|
|
41055
41245
|
const needArticle = "all" === postType || "article" === postType;
|
|
41056
41246
|
const AUTH_ERROR_CODES = [
|
|
41057
41247
|
300333,
|
|
41058
|
-
300334
|
|
41248
|
+
300334,
|
|
41249
|
+
300330,
|
|
41250
|
+
300331,
|
|
41251
|
+
300332
|
|
41059
41252
|
];
|
|
41060
41253
|
if (needVideo) try {
|
|
41061
41254
|
const videoPageUrl = "https://channels.weixin.qq.com/micro/content/post/list";
|
|
41062
41255
|
const videoResponse = await fetchPosts(pageNum, 11, videoPageUrl);
|
|
41256
|
+
_task.logger.info(`视频号视频获取响应:${JSON.stringify(videoResponse)}`);
|
|
41063
41257
|
if (videoResponse.errCode && AUTH_ERROR_CODES.includes(videoResponse.errCode)) throw new Error(`AUTH_ERROR:${videoResponse.errMsg || "登录已失效"}`);
|
|
41064
|
-
if (videoResponse.errCode)
|
|
41065
|
-
|
|
41258
|
+
if (videoResponse.errCode) {
|
|
41259
|
+
_task.logger.warn(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
|
|
41260
|
+
throw new Error(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
|
|
41261
|
+
}
|
|
41262
|
+
{
|
|
41066
41263
|
const posts = videoResponse.data?.list || videoResponse.posts || videoResponse.post_list || [];
|
|
41067
41264
|
const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
|
|
41068
41265
|
allArticles.push(...videoArticles);
|
|
@@ -41077,8 +41274,11 @@ var __webpack_exports__ = {};
|
|
|
41077
41274
|
const articlePageUrl = "https://channels.weixin.qq.com/micro/content/post/finderNewLifePostList";
|
|
41078
41275
|
const articleResponse = await fetchPosts(pageNum, 10, articlePageUrl);
|
|
41079
41276
|
if (articleResponse.errCode && AUTH_ERROR_CODES.includes(articleResponse.errCode)) throw new Error(`AUTH_ERROR:${articleResponse.errMsg || "登录已失效"}`);
|
|
41080
|
-
if (articleResponse.errCode)
|
|
41081
|
-
|
|
41277
|
+
if (articleResponse.errCode) {
|
|
41278
|
+
_task.logger.warn(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
|
|
41279
|
+
throw new Error(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
|
|
41280
|
+
}
|
|
41281
|
+
{
|
|
41082
41282
|
const posts = articleResponse.data?.list || articleResponse.posts || articleResponse.post_list || [];
|
|
41083
41283
|
const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
|
|
41084
41284
|
allArticles.push(...articleArticles);
|
|
@@ -50129,6 +50329,24 @@ var __webpack_exports__ = {};
|
|
|
50129
50329
|
likeNumYesterday: classic_schemas_number().nullable(),
|
|
50130
50330
|
commentNumYesterday: classic_schemas_number().nullable()
|
|
50131
50331
|
});
|
|
50332
|
+
classic_schemas_object({
|
|
50333
|
+
fansNum: classic_schemas_number(),
|
|
50334
|
+
favedNum: classic_schemas_number(),
|
|
50335
|
+
fansNumLastWeek: classic_schemas_number(),
|
|
50336
|
+
watchNumLastWeek: classic_schemas_number(),
|
|
50337
|
+
likeNumLastWeek: classic_schemas_number(),
|
|
50338
|
+
commentNumLastWeek: classic_schemas_number(),
|
|
50339
|
+
shareNumLastWeek: classic_schemas_number(),
|
|
50340
|
+
visitNumLastWeek: classic_schemas_number()
|
|
50341
|
+
});
|
|
50342
|
+
classic_schemas_object({
|
|
50343
|
+
fansNum: classic_schemas_number(),
|
|
50344
|
+
feedsCount: classic_schemas_number(),
|
|
50345
|
+
fansNumYesterday: classic_schemas_number().nullable(),
|
|
50346
|
+
playNumYesterday: classic_schemas_number().nullable(),
|
|
50347
|
+
likeNumYesterday: classic_schemas_number().nullable(),
|
|
50348
|
+
commentNumYesterday: classic_schemas_number().nullable()
|
|
50349
|
+
});
|
|
50132
50350
|
const BetaFlag = "HuiwenCanary";
|
|
50133
50351
|
class Action {
|
|
50134
50352
|
constructor(task){
|