@iflyrpa/actions 4.0.4-beta.0 → 4.0.4-beta.2
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/shipinhaoPublish/uploader.d.ts +4 -0
- package/dist/bundle.js +273 -46
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.js +273 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +273 -46
- 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
|
}
|
|
@@ -7,6 +7,9 @@ interface UploadConfig {
|
|
|
7
7
|
concurrentLimit?: number;
|
|
8
8
|
singleFileSize?: number;
|
|
9
9
|
http?: Http;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
retries?: number;
|
|
12
|
+
retryDelay?: number;
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
15
|
* 上传进度回调
|
|
@@ -26,6 +29,7 @@ export declare class VideoChannelUploader {
|
|
|
26
29
|
private concurrentLimit;
|
|
27
30
|
private singleFileSize;
|
|
28
31
|
private http;
|
|
32
|
+
private reqOptions;
|
|
29
33
|
private uploadTaskId;
|
|
30
34
|
private partInfo;
|
|
31
35
|
private md5;
|
package/dist/bundle.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/*! For license information please see bundle.js.LICENSE.txt */
|
|
2
|
+
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b2126d25-6ff1-5818-8cdb-7b95d8c6627c")}catch(e){}}();
|
|
2
4
|
var __webpack_modules__ = {
|
|
3
5
|
"../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
4
6
|
"use strict";
|
|
@@ -12488,7 +12490,7 @@ var __webpack_exports__ = {};
|
|
|
12488
12490
|
var package_namespaceObject = {
|
|
12489
12491
|
i8: "0.1.2"
|
|
12490
12492
|
};
|
|
12491
|
-
var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.4-beta.
|
|
12493
|
+
var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.4-beta.2"}');
|
|
12492
12494
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
12493
12495
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
12494
12496
|
const external_node_http_namespaceObject = require("node:http");
|
|
@@ -27268,11 +27270,12 @@ var __webpack_exports__ = {};
|
|
|
27268
27270
|
this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
|
|
27269
27271
|
errorString: stringifyError(error)
|
|
27270
27272
|
});
|
|
27271
|
-
_message =
|
|
27273
|
+
_message = `网络错误: ${error.message}`;
|
|
27272
27274
|
break;
|
|
27273
27275
|
}
|
|
27274
27276
|
}
|
|
27275
|
-
|
|
27277
|
+
if (error.code && !error.response?.data) errorResponse.message = _message || errorResponse.message;
|
|
27278
|
+
else errorResponse.message = errorResponse.message ? errorResponse.message : _message;
|
|
27276
27279
|
if ("canceled" === errorResponse.message) {
|
|
27277
27280
|
const message = errorResponse.extra?.isProxyRequest ? "代理连接建立超时,请更换区域或稍后重试!" : "网络请求超时,请稍后重试!";
|
|
27278
27281
|
errorResponse.message = message;
|
|
@@ -40430,6 +40433,199 @@ var __webpack_exports__ = {};
|
|
|
40430
40433
|
};
|
|
40431
40434
|
return success(bjhData, "百家号平台数据获取成功!");
|
|
40432
40435
|
}
|
|
40436
|
+
async function getDouyinData(_task, params) {
|
|
40437
|
+
try {
|
|
40438
|
+
const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
|
|
40439
|
+
if (!sessionidCookie) return types_errorResponse("抖音账号数据异常,请重新绑定账号后重试。", 414);
|
|
40440
|
+
const csrfToken = params.cookies.find((it)=>"passport_csrf_token" === it.name)?.value || "";
|
|
40441
|
+
const headers = {
|
|
40442
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
40443
|
+
referer: "https://creator.douyin.com/creator-micro/home",
|
|
40444
|
+
origin: "https://creator.douyin.com",
|
|
40445
|
+
"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",
|
|
40446
|
+
...csrfToken ? {
|
|
40447
|
+
"x-secsdk-csrf-token": csrfToken
|
|
40448
|
+
} : {}
|
|
40449
|
+
};
|
|
40450
|
+
const args = [
|
|
40451
|
+
{
|
|
40452
|
+
headers
|
|
40453
|
+
},
|
|
40454
|
+
_task.logger,
|
|
40455
|
+
params.proxyLoc,
|
|
40456
|
+
params.localIP,
|
|
40457
|
+
params.accountId
|
|
40458
|
+
];
|
|
40459
|
+
const http = new Http(...args);
|
|
40460
|
+
const toNum = (val)=>{
|
|
40461
|
+
if (null == val) return 0;
|
|
40462
|
+
const n = Number.parseInt(String(val).replace(/[+,]/g, ""), 10);
|
|
40463
|
+
return Number.isNaN(n) ? 0 : n;
|
|
40464
|
+
};
|
|
40465
|
+
const userProfileP = http.api({
|
|
40466
|
+
method: "get",
|
|
40467
|
+
url: "https://www.douyin.com/aweme/v1/web/user/profile/self/",
|
|
40468
|
+
params: {
|
|
40469
|
+
device_platform: "webapp",
|
|
40470
|
+
aid: "6383",
|
|
40471
|
+
channel: "channel_pc_web",
|
|
40472
|
+
pc_client_type: "1",
|
|
40473
|
+
version_code: "170400",
|
|
40474
|
+
version_name: "17.4.0",
|
|
40475
|
+
cookie_enabled: "true",
|
|
40476
|
+
platform: "PC"
|
|
40477
|
+
}
|
|
40478
|
+
}, {
|
|
40479
|
+
retries: 3,
|
|
40480
|
+
retryDelay: 100,
|
|
40481
|
+
timeout: 10000
|
|
40482
|
+
}).catch((e)=>{
|
|
40483
|
+
_task.logger.warn(`抖音用户信息获取失败: ${e instanceof Error ? e.message : String(e)}`);
|
|
40484
|
+
return null;
|
|
40485
|
+
});
|
|
40486
|
+
const overviewP = http.api({
|
|
40487
|
+
method: "get",
|
|
40488
|
+
url: "https://creator.douyin.com/aweme/janus/creator/data/overview/all/",
|
|
40489
|
+
params: {
|
|
40490
|
+
last_days_type: 1,
|
|
40491
|
+
aid: 2906,
|
|
40492
|
+
app_name: "aweme_creator_platform",
|
|
40493
|
+
device_platform: "web"
|
|
40494
|
+
}
|
|
40495
|
+
}, {
|
|
40496
|
+
retries: 3,
|
|
40497
|
+
retryDelay: 100,
|
|
40498
|
+
timeout: 5000
|
|
40499
|
+
}).catch((e)=>{
|
|
40500
|
+
_task.logger.warn(`抖音近7日数据获取失败(可能未开通数据中心或被风控): ${e instanceof Error ? e.message : String(e)}`);
|
|
40501
|
+
return null;
|
|
40502
|
+
});
|
|
40503
|
+
const [userProfile, overview] = await Promise.all([
|
|
40504
|
+
userProfileP,
|
|
40505
|
+
overviewP
|
|
40506
|
+
]);
|
|
40507
|
+
_task.logger.info(`抖音用户信息响应: ${JSON.stringify(userProfile)}`);
|
|
40508
|
+
_task.logger.info(`抖音近7日数据响应: ${JSON.stringify(overview)}`);
|
|
40509
|
+
let fansNum = 0;
|
|
40510
|
+
let favedNum = 0;
|
|
40511
|
+
let followingNum = 0;
|
|
40512
|
+
if (userProfile?.status_code === 0 && userProfile.user) {
|
|
40513
|
+
const user = userProfile.user;
|
|
40514
|
+
fansNum = toNum(user.follower_count);
|
|
40515
|
+
followingNum = toNum(user.following_count);
|
|
40516
|
+
favedNum = toNum(user.total_favorited);
|
|
40517
|
+
_task.logger.info(`提取用户数据 - 昵称: ${user.nickname}, 粉丝: ${fansNum}, 关注: ${followingNum}, 获赞: ${favedNum}, 作品: ${user.aweme_count}`);
|
|
40518
|
+
} else _task.logger.warn(`用户信息接口返回异常: status_code=${userProfile?.status_code}, msg=${userProfile?.status_msg}`);
|
|
40519
|
+
const ov = overview?.data;
|
|
40520
|
+
const douyinData = {
|
|
40521
|
+
fansNum,
|
|
40522
|
+
favedNum,
|
|
40523
|
+
fansNumLastWeek: toNum(ov?.fans_incr?.current_count),
|
|
40524
|
+
watchNumLastWeek: toNum(ov?.play_count?.current_count),
|
|
40525
|
+
likeNumLastWeek: toNum(ov?.like_count?.current_count),
|
|
40526
|
+
commentNumLastWeek: toNum(ov?.comment_count?.current_count),
|
|
40527
|
+
shareNumLastWeek: toNum(ov?.share_count?.current_count),
|
|
40528
|
+
visitNumLastWeek: toNum(ov?.profile_visit?.current_count)
|
|
40529
|
+
};
|
|
40530
|
+
return success(douyinData, "抖音平台数据获取成功!");
|
|
40531
|
+
} catch (error) {
|
|
40532
|
+
if (error && "object" == typeof error && "code" in error && "message" in error) {
|
|
40533
|
+
const err = error;
|
|
40534
|
+
_task.logger.error(`抖音账号数据获取失败: ${err.message} (${err.code})`);
|
|
40535
|
+
return types_errorResponse(err.message, err.code);
|
|
40536
|
+
}
|
|
40537
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
40538
|
+
_task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
|
|
40539
|
+
return types_errorResponse(errMsg || "抖音账号数据获取失败");
|
|
40540
|
+
}
|
|
40541
|
+
}
|
|
40542
|
+
async function getShipinhaoData(_task, params) {
|
|
40543
|
+
try {
|
|
40544
|
+
const sessionidCookie = params.cookies.find((it)=>"sessionid" === it.name)?.value;
|
|
40545
|
+
if (!sessionidCookie) return types_errorResponse("视频号账号数据异常,请重新绑定账号后重试。", 414);
|
|
40546
|
+
const uinCookie = params.cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
|
|
40547
|
+
const deviceIdCookie = params.cookies.find((it)=>"device_id" === it.name || "finger_print_device_id" === it.name)?.value;
|
|
40548
|
+
const aid = params.cookies.find((it)=>"_aid" === it.name)?.value || "9d3e0e9f-b842-498d-a273-4285d58df264";
|
|
40549
|
+
const finderId = params.cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
|
|
40550
|
+
const headers = {
|
|
40551
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
40552
|
+
referer: "https://channels.weixin.qq.com/platform",
|
|
40553
|
+
origin: "https://channels.weixin.qq.com",
|
|
40554
|
+
"content-type": "application/json",
|
|
40555
|
+
"X-WECHAT-UIN": uinCookie,
|
|
40556
|
+
...deviceIdCookie ? {
|
|
40557
|
+
"finger-print-device-id": deviceIdCookie
|
|
40558
|
+
} : {}
|
|
40559
|
+
};
|
|
40560
|
+
const args = [
|
|
40561
|
+
{
|
|
40562
|
+
headers
|
|
40563
|
+
},
|
|
40564
|
+
_task.logger,
|
|
40565
|
+
params.proxyLoc,
|
|
40566
|
+
params.localIP,
|
|
40567
|
+
params.accountId
|
|
40568
|
+
];
|
|
40569
|
+
const http = new Http(...args);
|
|
40570
|
+
const authData = await http.api({
|
|
40571
|
+
method: "post",
|
|
40572
|
+
url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/auth/auth_data",
|
|
40573
|
+
params: {
|
|
40574
|
+
_aid: aid,
|
|
40575
|
+
_rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
|
|
40576
|
+
_pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
|
|
40577
|
+
},
|
|
40578
|
+
data: {
|
|
40579
|
+
timestamp: Date.now().toString(),
|
|
40580
|
+
_log_finder_uin: "",
|
|
40581
|
+
_log_finder_id: finderId,
|
|
40582
|
+
rawKeyBuff: "",
|
|
40583
|
+
pluginSessionId: null,
|
|
40584
|
+
scene: 7,
|
|
40585
|
+
reqScene: 7
|
|
40586
|
+
}
|
|
40587
|
+
}, {
|
|
40588
|
+
retries: 3,
|
|
40589
|
+
retryDelay: 100,
|
|
40590
|
+
timeout: 5000
|
|
40591
|
+
});
|
|
40592
|
+
_task.logger.info(`视频号账号数据响应: ${JSON.stringify(authData)}`);
|
|
40593
|
+
const AUTH_ERROR_CODES = [
|
|
40594
|
+
300333,
|
|
40595
|
+
300334,
|
|
40596
|
+
300330,
|
|
40597
|
+
300331,
|
|
40598
|
+
300332
|
|
40599
|
+
];
|
|
40600
|
+
if (authData.errCode && AUTH_ERROR_CODES.includes(authData.errCode)) {
|
|
40601
|
+
_task.logger.warn(`视频号登录已失效:${authData.errMsg} (${authData.errCode})`);
|
|
40602
|
+
return types_errorResponse("视频号账号信息获取失败,请检查账号状态", 414);
|
|
40603
|
+
}
|
|
40604
|
+
if (authData.errCode) {
|
|
40605
|
+
_task.logger.warn(`视频号账号API错误:${authData.errMsg} (${authData.errCode})`);
|
|
40606
|
+
return types_errorResponse(`视频号账号信息获取失败:${authData.errMsg || "未知错误"}`, 414);
|
|
40607
|
+
}
|
|
40608
|
+
const finderUser = authData.data?.finderUser;
|
|
40609
|
+
const shipinhaoData = {
|
|
40610
|
+
fansNum: finderUser?.fansCount || 0,
|
|
40611
|
+
feedsCount: finderUser?.feedsCount || 0,
|
|
40612
|
+
fansNumYesterday: null,
|
|
40613
|
+
playNumYesterday: null,
|
|
40614
|
+
likeNumYesterday: null,
|
|
40615
|
+
commentNumYesterday: null
|
|
40616
|
+
};
|
|
40617
|
+
return success(shipinhaoData, "视频号平台数据获取成功!");
|
|
40618
|
+
} catch (error) {
|
|
40619
|
+
if (error && "object" == typeof error && "code" in error && "message" in error) {
|
|
40620
|
+
const err = error;
|
|
40621
|
+
_task.logger.error(`视频号账号数据获取失败: ${err.message} (${err.code})`);
|
|
40622
|
+
return types_errorResponse(err.message, err.code);
|
|
40623
|
+
}
|
|
40624
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
40625
|
+
_task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
|
|
40626
|
+
return types_errorResponse(errMsg || "视频号账号数据获取失败");
|
|
40627
|
+
}
|
|
40628
|
+
}
|
|
40433
40629
|
async function getToutiaoData(_task, params) {
|
|
40434
40630
|
const http = new Http({
|
|
40435
40631
|
headers: {
|
|
@@ -40528,7 +40724,7 @@ var __webpack_exports__ = {};
|
|
|
40528
40724
|
userInfoHtmlPromise,
|
|
40529
40725
|
userSummaryHtmlPromise
|
|
40530
40726
|
]);
|
|
40531
|
-
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("
|
|
40727
|
+
if (userInfoHtml.includes("请重新<a id='jumpUrl' href='/'>登录</a>")) return types_errorResponse("微信公众号数据获取失败,请检查账号状态", 414);
|
|
40532
40728
|
const userInfoJson = exportWxCgiData(userInfoHtml);
|
|
40533
40729
|
const userSummaryJson = exportWxCgiData(userSummaryHtml);
|
|
40534
40730
|
const wxData = {
|
|
@@ -40605,7 +40801,9 @@ var __webpack_exports__ = {};
|
|
|
40605
40801
|
"toutiao",
|
|
40606
40802
|
"xiaohongshu",
|
|
40607
40803
|
"weixin",
|
|
40608
|
-
"baijiahao"
|
|
40804
|
+
"baijiahao",
|
|
40805
|
+
"douyin",
|
|
40806
|
+
"shipinhao"
|
|
40609
40807
|
])
|
|
40610
40808
|
});
|
|
40611
40809
|
const SearchAccountInfo = async (_task, params)=>{
|
|
@@ -40619,6 +40817,10 @@ var __webpack_exports__ = {};
|
|
|
40619
40817
|
return getWeixinData(_task, params);
|
|
40620
40818
|
case "baijiahao":
|
|
40621
40819
|
return getBaijiahaoData(_task, params);
|
|
40820
|
+
case "douyin":
|
|
40821
|
+
return getDouyinData(_task, params);
|
|
40822
|
+
case "shipinhao":
|
|
40823
|
+
return getShipinhaoData(_task, params);
|
|
40622
40824
|
default:
|
|
40623
40825
|
return success(null, "暂不支持该平台");
|
|
40624
40826
|
}
|
|
@@ -40882,21 +41084,6 @@ var __webpack_exports__ = {};
|
|
|
40882
41084
|
params.accountId
|
|
40883
41085
|
];
|
|
40884
41086
|
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
41087
|
async function fetchWorks(cursor) {
|
|
40901
41088
|
return await http.api({
|
|
40902
41089
|
method: "get",
|
|
@@ -40915,25 +41102,31 @@ var __webpack_exports__ = {};
|
|
|
40915
41102
|
timeout: 5000
|
|
40916
41103
|
});
|
|
40917
41104
|
}
|
|
40918
|
-
const
|
|
40919
|
-
const
|
|
40920
|
-
|
|
41105
|
+
const isHasMore = (v)=>true === v || 1 === v;
|
|
41106
|
+
const skipCount = (pageNum - 1) * pageSize;
|
|
41107
|
+
const needCount = skipCount + pageSize;
|
|
41108
|
+
const workListResponse = await fetchWorks(0);
|
|
41109
|
+
if (!workListResponse || !Array.isArray(workListResponse.aweme_list)) return searchPublishInfo_types_errorResponse("抖音数据获取失败,请检查账号状态", 414);
|
|
40921
41110
|
const allWorks = [
|
|
40922
41111
|
...workListResponse.aweme_list
|
|
40923
41112
|
];
|
|
40924
|
-
let hasMore = workListResponse.has_more;
|
|
40925
|
-
let currentCursor = workListResponse.max_cursor;
|
|
40926
|
-
|
|
41113
|
+
let hasMore = isHasMore(workListResponse.has_more);
|
|
41114
|
+
let currentCursor = workListResponse.cursor ?? workListResponse.max_cursor ?? 0;
|
|
41115
|
+
let guard = 0;
|
|
41116
|
+
while(allWorks.length < needCount && hasMore && guard < 20){
|
|
40927
41117
|
const nextPageResponse = await fetchWorks(currentCursor);
|
|
41118
|
+
if (!Array.isArray(nextPageResponse.aweme_list) || 0 === nextPageResponse.aweme_list.length) break;
|
|
40928
41119
|
allWorks.push(...nextPageResponse.aweme_list);
|
|
40929
|
-
hasMore = nextPageResponse.has_more;
|
|
40930
|
-
currentCursor = nextPageResponse.max_cursor;
|
|
40931
|
-
|
|
41120
|
+
hasMore = isHasMore(nextPageResponse.has_more);
|
|
41121
|
+
currentCursor = nextPageResponse.cursor ?? nextPageResponse.max_cursor ?? currentCursor;
|
|
41122
|
+
guard++;
|
|
40932
41123
|
}
|
|
40933
|
-
const finalWorks = allWorks.slice(
|
|
41124
|
+
const finalWorks = allWorks.slice(skipCount, needCount);
|
|
40934
41125
|
const articleCell = finalWorks.map((item)=>{
|
|
40935
41126
|
const workDetailUrl = `https://creator.douyin.com/creator-micro/work-management/work-detail/${item.aweme_id}`;
|
|
40936
|
-
const workPublicUrl =
|
|
41127
|
+
const workPublicUrl = item.share_url || `https://www.douyin.com/video/${item.aweme_id}`;
|
|
41128
|
+
let statusText;
|
|
41129
|
+
statusText = item.status?.is_delete ? "deleted" : item.status?.is_private ? "private" : item.status?.in_reviewing ? "reviewing" : "public";
|
|
40937
41130
|
return {
|
|
40938
41131
|
title: item.desc || "无作品描述",
|
|
40939
41132
|
imageUrl: item.Cover?.url_list?.[0] || "",
|
|
@@ -40945,9 +41138,9 @@ var __webpack_exports__ = {};
|
|
|
40945
41138
|
shareNum: item.statistics?.share_count || 0,
|
|
40946
41139
|
collectNum: item.statistics?.collect_count || 0,
|
|
40947
41140
|
awemeId: item.aweme_id,
|
|
40948
|
-
awemeType: item.aweme_type,
|
|
41141
|
+
awemeType: item.aweme_type ?? 0,
|
|
40949
41142
|
duration: item.duration,
|
|
40950
|
-
status:
|
|
41143
|
+
status: statusText,
|
|
40951
41144
|
publicUrl: workPublicUrl,
|
|
40952
41145
|
...showOriginalData ? {
|
|
40953
41146
|
originalData: item
|
|
@@ -40958,8 +41151,8 @@ var __webpack_exports__ = {};
|
|
|
40958
41151
|
articleCell,
|
|
40959
41152
|
...onlySuccess ? {
|
|
40960
41153
|
pagination: {
|
|
40961
|
-
total: workListResponse.total ||
|
|
40962
|
-
nextPage:
|
|
41154
|
+
total: workListResponse.total || allWorks.length,
|
|
41155
|
+
nextPage: hasMore,
|
|
40963
41156
|
pageNum,
|
|
40964
41157
|
pageSize
|
|
40965
41158
|
}
|
|
@@ -41055,14 +41248,21 @@ var __webpack_exports__ = {};
|
|
|
41055
41248
|
const needArticle = "all" === postType || "article" === postType;
|
|
41056
41249
|
const AUTH_ERROR_CODES = [
|
|
41057
41250
|
300333,
|
|
41058
|
-
300334
|
|
41251
|
+
300334,
|
|
41252
|
+
300330,
|
|
41253
|
+
300331,
|
|
41254
|
+
300332
|
|
41059
41255
|
];
|
|
41060
41256
|
if (needVideo) try {
|
|
41061
41257
|
const videoPageUrl = "https://channels.weixin.qq.com/micro/content/post/list";
|
|
41062
41258
|
const videoResponse = await fetchPosts(pageNum, 11, videoPageUrl);
|
|
41259
|
+
_task.logger.info(`视频号视频获取响应:${JSON.stringify(videoResponse)}`);
|
|
41063
41260
|
if (videoResponse.errCode && AUTH_ERROR_CODES.includes(videoResponse.errCode)) throw new Error(`AUTH_ERROR:${videoResponse.errMsg || "登录已失效"}`);
|
|
41064
|
-
if (videoResponse.errCode)
|
|
41065
|
-
|
|
41261
|
+
if (videoResponse.errCode) {
|
|
41262
|
+
_task.logger.warn(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
|
|
41263
|
+
throw new Error(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
|
|
41264
|
+
}
|
|
41265
|
+
{
|
|
41066
41266
|
const posts = videoResponse.data?.list || videoResponse.posts || videoResponse.post_list || [];
|
|
41067
41267
|
const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
|
|
41068
41268
|
allArticles.push(...videoArticles);
|
|
@@ -41077,8 +41277,11 @@ var __webpack_exports__ = {};
|
|
|
41077
41277
|
const articlePageUrl = "https://channels.weixin.qq.com/micro/content/post/finderNewLifePostList";
|
|
41078
41278
|
const articleResponse = await fetchPosts(pageNum, 10, articlePageUrl);
|
|
41079
41279
|
if (articleResponse.errCode && AUTH_ERROR_CODES.includes(articleResponse.errCode)) throw new Error(`AUTH_ERROR:${articleResponse.errMsg || "登录已失效"}`);
|
|
41080
|
-
if (articleResponse.errCode)
|
|
41081
|
-
|
|
41280
|
+
if (articleResponse.errCode) {
|
|
41281
|
+
_task.logger.warn(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
|
|
41282
|
+
throw new Error(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
|
|
41283
|
+
}
|
|
41284
|
+
{
|
|
41082
41285
|
const posts = articleResponse.data?.list || articleResponse.posts || articleResponse.post_list || [];
|
|
41083
41286
|
const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
|
|
41084
41287
|
allArticles.push(...articleArticles);
|
|
@@ -42967,6 +43170,11 @@ var __webpack_exports__ = {};
|
|
|
42967
43170
|
this.concurrentLimit = config.concurrentLimit || 4;
|
|
42968
43171
|
this.singleFileSize = config.singleFileSize || 10485760;
|
|
42969
43172
|
this.http = config.http || new Http();
|
|
43173
|
+
this.reqOptions = {
|
|
43174
|
+
timeout: config.timeout ?? 60000,
|
|
43175
|
+
retries: config.retries ?? 3,
|
|
43176
|
+
retryDelay: config.retryDelay ?? 2000
|
|
43177
|
+
};
|
|
42970
43178
|
}
|
|
42971
43179
|
calculateMd5(buffer) {
|
|
42972
43180
|
const MAX_SIZE = 5242880;
|
|
@@ -43023,7 +43231,7 @@ var __webpack_exports__ = {};
|
|
|
43023
43231
|
url: filePath,
|
|
43024
43232
|
method: "get",
|
|
43025
43233
|
responseType: "arraybuffer"
|
|
43026
|
-
});
|
|
43234
|
+
}, this.reqOptions);
|
|
43027
43235
|
return Buffer.from(resp);
|
|
43028
43236
|
}
|
|
43029
43237
|
return external_node_fs_default().promises.readFile(filePath);
|
|
@@ -43053,7 +43261,7 @@ var __webpack_exports__ = {};
|
|
|
43053
43261
|
headers,
|
|
43054
43262
|
data: requestBody,
|
|
43055
43263
|
defaultErrorMsg: "获取UploadID失败"
|
|
43056
|
-
});
|
|
43264
|
+
}, this.reqOptions);
|
|
43057
43265
|
if (!resp?.UploadID) throw new Error(`获取 UploadID 失败: ${resp?.errMsg || "未知错误"}`);
|
|
43058
43266
|
return resp.UploadID;
|
|
43059
43267
|
}
|
|
@@ -43074,7 +43282,7 @@ var __webpack_exports__ = {};
|
|
|
43074
43282
|
headers,
|
|
43075
43283
|
data: chunk,
|
|
43076
43284
|
defaultErrorMsg: `分片 ${partNumber} 上传失败`
|
|
43077
|
-
});
|
|
43285
|
+
}, this.reqOptions);
|
|
43078
43286
|
if (resp?.errCode !== void 0 && 0 !== resp.errCode) throw new Error(`分片 ${partNumber} 上传失败: ${resp.errMsg}`);
|
|
43079
43287
|
if (onProgress) onProgress(chunk.length);
|
|
43080
43288
|
return resp.ETag || "";
|
|
@@ -43098,7 +43306,7 @@ var __webpack_exports__ = {};
|
|
|
43098
43306
|
headers,
|
|
43099
43307
|
data: requestBody,
|
|
43100
43308
|
defaultErrorMsg: "确认分片上传失败"
|
|
43101
|
-
});
|
|
43309
|
+
}, this.reqOptions);
|
|
43102
43310
|
if (resp?.ListPartsResult?.Part) return resp.ListPartsResult.Part.map((p)=>({
|
|
43103
43311
|
PartNumber: parseInt(p.PartNumber),
|
|
43104
43312
|
ETag: p.ETag
|
|
@@ -43124,7 +43332,7 @@ var __webpack_exports__ = {};
|
|
|
43124
43332
|
headers,
|
|
43125
43333
|
data: requestBody,
|
|
43126
43334
|
defaultErrorMsg: "完成上传失败"
|
|
43127
|
-
});
|
|
43335
|
+
}, this.reqOptions);
|
|
43128
43336
|
if (!resp?.DownloadURL) throw new Error(`完成上传失败: ${resp?.errMsg || "未知错误"}`);
|
|
43129
43337
|
return resp.DownloadURL;
|
|
43130
43338
|
}
|
|
@@ -50129,6 +50337,24 @@ var __webpack_exports__ = {};
|
|
|
50129
50337
|
likeNumYesterday: classic_schemas_number().nullable(),
|
|
50130
50338
|
commentNumYesterday: classic_schemas_number().nullable()
|
|
50131
50339
|
});
|
|
50340
|
+
classic_schemas_object({
|
|
50341
|
+
fansNum: classic_schemas_number(),
|
|
50342
|
+
favedNum: classic_schemas_number(),
|
|
50343
|
+
fansNumLastWeek: classic_schemas_number(),
|
|
50344
|
+
watchNumLastWeek: classic_schemas_number(),
|
|
50345
|
+
likeNumLastWeek: classic_schemas_number(),
|
|
50346
|
+
commentNumLastWeek: classic_schemas_number(),
|
|
50347
|
+
shareNumLastWeek: classic_schemas_number(),
|
|
50348
|
+
visitNumLastWeek: classic_schemas_number()
|
|
50349
|
+
});
|
|
50350
|
+
classic_schemas_object({
|
|
50351
|
+
fansNum: classic_schemas_number(),
|
|
50352
|
+
feedsCount: classic_schemas_number(),
|
|
50353
|
+
fansNumYesterday: classic_schemas_number().nullable(),
|
|
50354
|
+
playNumYesterday: classic_schemas_number().nullable(),
|
|
50355
|
+
likeNumYesterday: classic_schemas_number().nullable(),
|
|
50356
|
+
commentNumYesterday: classic_schemas_number().nullable()
|
|
50357
|
+
});
|
|
50132
50358
|
const BetaFlag = "HuiwenCanary";
|
|
50133
50359
|
class Action {
|
|
50134
50360
|
constructor(task){
|
|
@@ -50417,4 +50643,5 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
|
|
|
50417
50643
|
value: true
|
|
50418
50644
|
});
|
|
50419
50645
|
|
|
50420
|
-
//# sourceMappingURL=bundle.js.map
|
|
50646
|
+
//# sourceMappingURL=bundle.js.map
|
|
50647
|
+
//# debugId=b2126d25-6ff1-5818-8cdb-7b95d8c6627c
|