@iflyrpa/actions 1.2.14-beta.1 → 1.2.14-beta.3
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/getBjhInfo.d.ts +3 -0
- package/dist/actions/searchAccountInfo/getTTInfo.d.ts +3 -0
- package/dist/actions/searchAccountInfo/getWxInfo.d.ts +3 -0
- package/dist/actions/searchAccountInfo/getXhsInfo.d.ts +3 -0
- package/dist/actions/searchAccountInfo/index.d.ts +2 -40
- package/dist/actions/searchAccountInfo/types.d.ts +44 -0
- package/dist/actions/searchPublishInfo/handleBjhData.d.ts +3 -0
- package/dist/actions/searchPublishInfo/handleTTData.d.ts +3 -0
- package/dist/actions/searchPublishInfo/handleWXData.d.ts +3 -0
- package/dist/actions/searchPublishInfo/handleXhsData.d.ts +3 -0
- package/dist/actions/searchPublishInfo/index.d.ts +2 -45
- package/dist/actions/searchPublishInfo/types.d.ts +49 -0
- package/dist/bundle.js +548 -496
- package/dist/bundle.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +550 -498
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +546 -494
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2,124 +2,32 @@ import * as __WEBPACK_EXTERNAL_MODULE_dom_serializer_aa70940b__ from "dom-serial
|
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_domhandler__ from "domhandler";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_htmlparser2__ from "htmlparser2";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_mime_types_eebf54a5__ from "mime-types";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__ from "node:buffer";
|
|
6
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__ from "node:crypto";
|
|
7
5
|
import * as __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__ from "@iflyrpa/share";
|
|
8
6
|
import * as __WEBPACK_EXTERNAL_MODULE_axios__ from "axios";
|
|
9
7
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
10
8
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
11
9
|
import * as __WEBPACK_EXTERNAL_MODULE_form_data_cf000082__ from "form-data";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__ from "node:buffer";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__ from "node:crypto";
|
|
12
12
|
var __webpack_modules__ = {
|
|
13
|
-
"./src/actions/searchAccountInfo/
|
|
13
|
+
"./src/actions/searchAccountInfo/getWxInfo.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
14
14
|
__webpack_require__.d(__webpack_exports__, {
|
|
15
|
-
|
|
15
|
+
n: ()=>getWeixinData
|
|
16
16
|
});
|
|
17
17
|
var _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@iflyrpa/share");
|
|
18
|
-
var
|
|
18
|
+
var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/actions/searchAccountInfo/types.ts");
|
|
19
19
|
var _utils_http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/utils/http.ts");
|
|
20
|
-
var
|
|
21
|
-
const errorResponse = (message, code = 500)=>({
|
|
22
|
-
code,
|
|
23
|
-
message,
|
|
24
|
-
data: null
|
|
25
|
-
});
|
|
26
|
-
async function getToutiaoData(params) {
|
|
27
|
-
try {
|
|
28
|
-
const http = new _utils_http__WEBPACK_IMPORTED_MODULE_2__.e({
|
|
29
|
-
headers: {
|
|
30
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
31
|
-
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const [totalData, fansDataYesterday, contentDataYesterday] = await Promise.all([
|
|
35
|
-
http.api({
|
|
36
|
-
method: "get",
|
|
37
|
-
url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
|
|
38
|
-
params: {
|
|
39
|
-
app_id: 1231
|
|
40
|
-
}
|
|
41
|
-
}),
|
|
42
|
-
http.api({
|
|
43
|
-
method: "get",
|
|
44
|
-
url: "https://mp.toutiao.com/mp/agw/statistic/v2/fans/latest_stat",
|
|
45
|
-
params: {
|
|
46
|
-
app_id: 1231
|
|
47
|
-
}
|
|
48
|
-
}),
|
|
49
|
-
http.api({
|
|
50
|
-
method: "get",
|
|
51
|
-
url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
|
|
52
|
-
params: {
|
|
53
|
-
type: 0,
|
|
54
|
-
app_id: 1231
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
]);
|
|
58
|
-
const ttData = {
|
|
59
|
-
fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
|
|
60
|
-
fansNumYesterday: fansDataYesterday.fans_stat.change_count,
|
|
61
|
-
readNum: Number(totalData.data.statistic.data.total_read_play_count),
|
|
62
|
-
incomeNum: totalData.data.statistic.data.total_income,
|
|
63
|
-
incomeNumYesterday: totalData.data.statistic.data.yesterday_income,
|
|
64
|
-
showNumYesterday: contentDataYesterday.author_stat.consume_data.impression_count,
|
|
65
|
-
readNumYesterday: contentDataYesterday.author_stat.consume_data.go_detail_count,
|
|
66
|
-
likeNumYesterday: contentDataYesterday.author_stat.interaction_data.digg_count,
|
|
67
|
-
commentNumYesterday: contentDataYesterday.author_stat.interaction_data.comment_count
|
|
68
|
-
};
|
|
69
|
-
return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.success)(ttData, "头条号粉丝数据获取成功!");
|
|
70
|
-
} catch (error) {
|
|
71
|
-
return errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async function getXiaohongshuData(params) {
|
|
75
|
-
try {
|
|
76
|
-
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
77
|
-
if (!a1Cookie) return errorResponse("账号数据异常,请重新绑定账号后重试。", 200);
|
|
78
|
-
const http = new _utils_http__WEBPACK_IMPORTED_MODULE_2__.e({
|
|
79
|
-
headers: {
|
|
80
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
81
|
-
referer: "https://creator.xiaohongshu.com",
|
|
82
|
-
origin: "https://creator.xiaohongshu.com"
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
const xsEncrypt = new _utils_xhsXsEncrypt__WEBPACK_IMPORTED_MODULE_3__.H();
|
|
86
|
-
const xt = Date.now().toString();
|
|
87
|
-
const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
|
|
88
|
-
const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
|
|
89
|
-
const [overAllData, sevenData] = await Promise.all([
|
|
90
|
-
http.api({
|
|
91
|
-
method: "get",
|
|
92
|
-
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
93
|
-
}),
|
|
94
|
-
http.api({
|
|
95
|
-
method: "get",
|
|
96
|
-
baseURL: "https://creator.xiaohongshu.com",
|
|
97
|
-
url: sevenDataUrl,
|
|
98
|
-
headers: {
|
|
99
|
-
"x-s": xs,
|
|
100
|
-
"x-t": xt
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
]);
|
|
104
|
-
const xhsData = {
|
|
105
|
-
fansNum: overAllData.data.fans_count,
|
|
106
|
-
favedNum: overAllData.data.faved_count,
|
|
107
|
-
watchNumLastWeek: sevenData.data.seven.view_count,
|
|
108
|
-
likeNumLastWeek: sevenData.data.seven.like_count,
|
|
109
|
-
collectNumLastWeek: sevenData.data.seven.collect_count,
|
|
110
|
-
commentNumLastWeek: sevenData.data.seven.comment_count,
|
|
111
|
-
fansNumLastWeek: sevenData.data.seven.rise_fans_count,
|
|
112
|
-
fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
|
|
113
|
-
};
|
|
114
|
-
return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.success)(xhsData, "小红书粉丝数据获取成功!");
|
|
115
|
-
} catch (error) {
|
|
116
|
-
return errorResponse(error instanceof Error ? error.message : "小红书数据获取失败");
|
|
117
|
-
}
|
|
118
|
-
}
|
|
20
|
+
var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
|
|
119
21
|
async function getWeixinData(params) {
|
|
22
|
+
const { token } = params;
|
|
23
|
+
if (!token) return {
|
|
24
|
+
code: 200,
|
|
25
|
+
message: "缺少token",
|
|
26
|
+
data: null
|
|
27
|
+
};
|
|
120
28
|
try {
|
|
121
29
|
const { token } = params;
|
|
122
|
-
if (!token) return
|
|
30
|
+
if (!token) return (0, _types__WEBPACK_IMPORTED_MODULE_1__.V)("缺少token", 200);
|
|
123
31
|
const http = new _utils_http__WEBPACK_IMPORTED_MODULE_2__.e({
|
|
124
32
|
headers: {
|
|
125
33
|
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
@@ -127,7 +35,7 @@ var __webpack_modules__ = {
|
|
|
127
35
|
});
|
|
128
36
|
const massRandomIDHtml = await http.api({
|
|
129
37
|
method: "get",
|
|
130
|
-
url: "https://mp.weixin.qq.com/misc/appmsganalysis
|
|
38
|
+
url: "https://mp.weixin.qq.com/misc/appmsganalysis",
|
|
131
39
|
params: {
|
|
132
40
|
token,
|
|
133
41
|
lang: "zh_CN",
|
|
@@ -157,11 +65,11 @@ var __webpack_modules__ = {
|
|
|
157
65
|
const readAllList = arrays.readAllList || [];
|
|
158
66
|
const shareAllList = arrays.shareAllList || [];
|
|
159
67
|
const fansInfoReg = fansInfoHtml.match(/window\.CGI_DATA\['pages\/statistics\/user_statistics'\]\s*=\s*(\{[\s\S]*?\});/);
|
|
160
|
-
if (!fansInfoReg) return
|
|
68
|
+
if (!fansInfoReg) return (0, _types__WEBPACK_IMPORTED_MODULE_1__.V)("未找到粉丝信息", 200);
|
|
161
69
|
const fansInfo = eval("(" + fansInfoReg[1] + ")");
|
|
162
|
-
const yesterday =
|
|
70
|
+
const yesterday = _utils__WEBPACK_IMPORTED_MODULE_3__.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyy-MM-dd");
|
|
163
71
|
const yesterdayFansInfo = fansInfo.list[0]?.list.find((item)=>item.date === yesterday);
|
|
164
|
-
if (!yesterdayFansInfo) return
|
|
72
|
+
if (!yesterdayFansInfo) return (0, _types__WEBPACK_IMPORTED_MODULE_1__.V)("未找到粉丝数", 200);
|
|
165
73
|
const wxData = {
|
|
166
74
|
fansNum: yesterdayFansInfo.cumulate_user,
|
|
167
75
|
fansNumYesterday: yesterdayFansInfo.new_user - yesterdayFansInfo.cancel_user,
|
|
@@ -170,70 +78,19 @@ var __webpack_modules__ = {
|
|
|
170
78
|
};
|
|
171
79
|
return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.success)(wxData, "微信粉丝数据获取成功!");
|
|
172
80
|
} catch (error) {
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
async function getBaijiahaoData(params) {
|
|
177
|
-
try {
|
|
178
|
-
const { token } = params;
|
|
179
|
-
if (!token) return errorResponse("缺少token", 200);
|
|
180
|
-
const http = new _utils_http__WEBPACK_IMPORTED_MODULE_2__.e({
|
|
181
|
-
headers: {
|
|
182
|
-
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
183
|
-
token: String(token),
|
|
184
|
-
Referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
const yesterday = _utils_index__WEBPACK_IMPORTED_MODULE_1__.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
|
|
188
|
-
const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
|
|
189
|
-
http.api({
|
|
190
|
-
method: "get",
|
|
191
|
-
url: "https://baijiahao.baidu.com/pcui/home/index"
|
|
192
|
-
}),
|
|
193
|
-
http.api({
|
|
194
|
-
method: "get",
|
|
195
|
-
url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
|
|
196
|
-
}),
|
|
197
|
-
http.api({
|
|
198
|
-
method: "get",
|
|
199
|
-
url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
|
|
200
|
-
}),
|
|
201
|
-
http.api({
|
|
202
|
-
method: "get",
|
|
203
|
-
url: `https://baijiahao.baidu.com/author/eco/statistics/appStatistic?type=all&is_yesterday=false&start_day=${yesterday}&end_day=${yesterday}&stat=0`
|
|
204
|
-
})
|
|
205
|
-
]);
|
|
206
|
-
const bjhData = {
|
|
207
|
-
fansNum: fansData.data.coreData.fansCount,
|
|
208
|
-
fansNumYesterday: yesterdayData.data.data.fans_increase,
|
|
209
|
-
readNum: readData.data.total.view_count,
|
|
210
|
-
incomeNum: incomeData.data.all_income.total_income,
|
|
211
|
-
incomeNumYesterday: incomeData.data.all_income.yesterday_income,
|
|
212
|
-
recommendNumYesterday: yesterdayData.data.data.recommend_count,
|
|
213
|
-
readNumYesterday: yesterdayData.data.data.view_count,
|
|
214
|
-
likeNumYesterday: yesterdayData.data.data.likes_count,
|
|
215
|
-
commentNumYesterday: yesterdayData.data.data.comment_count
|
|
216
|
-
};
|
|
217
|
-
return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.success)(bjhData, "百家号粉丝数据获取成功!");
|
|
218
|
-
} catch (error) {
|
|
219
|
-
return errorResponse(error instanceof Error ? error.message : "百家号数据获取失败");
|
|
81
|
+
return (0, _types__WEBPACK_IMPORTED_MODULE_1__.V)(error instanceof Error ? error.message : "微信数据获取失败");
|
|
220
82
|
}
|
|
221
83
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return getBaijiahaoData(params);
|
|
233
|
-
default:
|
|
234
|
-
return (0, _iflyrpa_share__WEBPACK_IMPORTED_MODULE_0__.success)(null, "暂不支持该平台");
|
|
235
|
-
}
|
|
236
|
-
};
|
|
84
|
+
},
|
|
85
|
+
"./src/actions/searchAccountInfo/types.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
86
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
87
|
+
V: ()=>errorResponse
|
|
88
|
+
});
|
|
89
|
+
const errorResponse = (message, code = 500)=>({
|
|
90
|
+
code,
|
|
91
|
+
message,
|
|
92
|
+
data: null
|
|
93
|
+
});
|
|
237
94
|
},
|
|
238
95
|
"./src/utils/http.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
239
96
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -1594,61 +1451,6 @@ var __webpack_modules__ = {
|
|
|
1594
1451
|
}
|
|
1595
1452
|
module[a0_0x45db08(0xae)] = GenAB;
|
|
1596
1453
|
},
|
|
1597
|
-
"./src/utils/xhsXsEncrypt.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1598
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
1599
|
-
H: ()=>XsEncrypt
|
|
1600
|
-
});
|
|
1601
|
-
class XsEncrypt {
|
|
1602
|
-
async encryptMD5(url) {
|
|
1603
|
-
return __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createHash("md5").update(url, "utf8").digest("hex");
|
|
1604
|
-
}
|
|
1605
|
-
async encryptText(text) {
|
|
1606
|
-
const textEncoded = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(text).toString("base64");
|
|
1607
|
-
const cipher = __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
|
|
1608
|
-
const ciphertext = cipher.update(textEncoded, "utf8", "base64");
|
|
1609
|
-
return ciphertext + cipher.final("base64");
|
|
1610
|
-
}
|
|
1611
|
-
async base64ToHex(encodedData) {
|
|
1612
|
-
const decodedData = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(encodedData, "base64");
|
|
1613
|
-
return decodedData.toString("hex");
|
|
1614
|
-
}
|
|
1615
|
-
async encryptPayload(payload, platform) {
|
|
1616
|
-
const hexPayload = await this.base64ToHex(payload);
|
|
1617
|
-
const obj = {
|
|
1618
|
-
signSvn: "56",
|
|
1619
|
-
signType: "x2",
|
|
1620
|
-
appID: platform,
|
|
1621
|
-
signVersion: "1",
|
|
1622
|
-
payload: hexPayload
|
|
1623
|
-
};
|
|
1624
|
-
const jsonString = JSON.stringify(obj, null, 0);
|
|
1625
|
-
return __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(jsonString).toString("base64");
|
|
1626
|
-
}
|
|
1627
|
-
async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
|
|
1628
|
-
const text = `x1=${await this.encryptMD5(`url=${url}`)};x2=0|0|0|1|0|0|1|0|0|0|1|0|0|0|0|1|0|0|0;x3=${a1};x4=${ts};`;
|
|
1629
|
-
return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
|
|
1630
|
-
}
|
|
1631
|
-
dumps(...rest) {
|
|
1632
|
-
const [data, replacer = null, space = 0] = rest;
|
|
1633
|
-
return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
|
|
1634
|
-
}
|
|
1635
|
-
constructor(){
|
|
1636
|
-
this.words = [
|
|
1637
|
-
929260340,
|
|
1638
|
-
1633971297,
|
|
1639
|
-
895580464,
|
|
1640
|
-
925905270
|
|
1641
|
-
];
|
|
1642
|
-
this.keyBytes = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.concat(this.words.map((word)=>new Uint8Array(__WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from([
|
|
1643
|
-
word >> 24 & 0xff,
|
|
1644
|
-
word >> 16 & 0xff,
|
|
1645
|
-
word >> 8 & 0xff,
|
|
1646
|
-
0xff & word
|
|
1647
|
-
]))));
|
|
1648
|
-
this.iv = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from("4uzjr7mbsibcaldp", "utf8");
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
},
|
|
1652
1454
|
"@iflyrpa/share": function(module) {
|
|
1653
1455
|
module.exports = __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__;
|
|
1654
1456
|
},
|
|
@@ -2950,280 +2752,530 @@ const BjhSessionCheck = async (_task, params)=>{
|
|
|
2950
2752
|
}, "百家号账号有效性检测失败!");
|
|
2951
2753
|
}
|
|
2952
2754
|
};
|
|
2953
|
-
var
|
|
2954
|
-
|
|
2955
|
-
const FetchArticles = async (_task, params)=>{
|
|
2956
|
-
const { platform, cookies, token, pageNum = 1, pageSize = 10, onlySuccess = false, showOriginalData = false } = params;
|
|
2755
|
+
var types = __webpack_require__("./src/actions/searchAccountInfo/types.ts");
|
|
2756
|
+
async function getBaijiahaoData(params) {
|
|
2957
2757
|
try {
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
client_extra_params: `{"category":"mp_all","real_app_id":"1231","need_forward":"true","offset_mode":"1","page_index":"1","status":${onlySuccess ? "2" : "8"},"source":"0"}`,
|
|
2991
|
-
app_id: "1231"
|
|
2992
|
-
}
|
|
2993
|
-
});
|
|
2994
|
-
const articleCell = articleInfo.data.map((item)=>({
|
|
2995
|
-
title: item.assembleCell.itemCell.articleBase.title,
|
|
2996
|
-
imageUrl: item.assembleCell.itemCell.imageList.staggerFeedCover[0].url,
|
|
2997
|
-
createTime: item.assembleCell.itemCell.articleBase.publishTime,
|
|
2998
|
-
redirectUrl: item.assembleCell.itemCell.articleBase.articleURL,
|
|
2999
|
-
showNum: item.assembleCell.itemCell.itemCounter.showCount,
|
|
3000
|
-
readNum: item.assembleCell.itemCell.itemCounter.readCount,
|
|
3001
|
-
likeNum: item.assembleCell.itemCell.itemCounter.diggCount,
|
|
3002
|
-
commentNum: item.assembleCell.itemCell.itemCounter.commentCount,
|
|
3003
|
-
...showOriginalData ? {
|
|
3004
|
-
originalData: item
|
|
3005
|
-
} : {}
|
|
3006
|
-
}));
|
|
3007
|
-
const api_base_info_json = JSON.parse(articleInfo.api_base_info.app_extra_params);
|
|
3008
|
-
return (0, share_.success)({
|
|
3009
|
-
articleCell,
|
|
3010
|
-
pagination: {
|
|
3011
|
-
total: api_base_info_json.total_count,
|
|
3012
|
-
pageNum,
|
|
3013
|
-
pageSize
|
|
3014
|
-
}
|
|
3015
|
-
}, "头条号文章获取成功");
|
|
2758
|
+
const { token } = params;
|
|
2759
|
+
if (!token) return (0, types.V)("缺少token", 200);
|
|
2760
|
+
const http = new utils_http.e({
|
|
2761
|
+
headers: {
|
|
2762
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2763
|
+
token: String(token),
|
|
2764
|
+
Referer: "https://baijiahao.baidu.com/builder/rc/home"
|
|
2765
|
+
}
|
|
2766
|
+
});
|
|
2767
|
+
const yesterday = utils.Tx.format(new Date().setDate(new Date().getDate() - 1), "yyyyMMdd");
|
|
2768
|
+
const [fansData, readData, incomeData, yesterdayData] = await Promise.all([
|
|
2769
|
+
http.api({
|
|
2770
|
+
method: "get",
|
|
2771
|
+
url: "https://baijiahao.baidu.com/pcui/home/index"
|
|
2772
|
+
}),
|
|
2773
|
+
http.api({
|
|
2774
|
+
method: "get",
|
|
2775
|
+
url: "https://baijiahao.baidu.com/author/eco/statistic/getauthorhistory"
|
|
2776
|
+
}),
|
|
2777
|
+
http.api({
|
|
2778
|
+
method: "get",
|
|
2779
|
+
url: "https://baijiahao.baidu.com/author/eco/income4/homepageincome"
|
|
2780
|
+
}),
|
|
2781
|
+
http.api({
|
|
2782
|
+
method: "get",
|
|
2783
|
+
url: "https://baijiahao.baidu.com/author/eco/statistics/appStatistic",
|
|
2784
|
+
params: {
|
|
2785
|
+
type: "all",
|
|
2786
|
+
is_yesterday: false,
|
|
2787
|
+
start_day: yesterday,
|
|
2788
|
+
end_day: yesterday,
|
|
2789
|
+
stat: 0
|
|
3016
2790
|
}
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish?sub=list&begin=0&count=10&token=1453947575&lang=zh_CN',
|
|
3051
|
-
params: {
|
|
3052
|
-
sub: "list",
|
|
3053
|
-
begin: (pageNum - 1) * pageSize,
|
|
3054
|
-
count: pageSize,
|
|
3055
|
-
token: token,
|
|
3056
|
-
lang: "zh_CN"
|
|
3057
|
-
}
|
|
3058
|
-
});
|
|
3059
|
-
const articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
3060
|
-
const articleCell = articlesInfo?.publish_list.map((item)=>({
|
|
3061
|
-
title: item.publish_info.appmsg_info[0].title,
|
|
3062
|
-
imageUrl: item.publish_info.appmsg_info[0].cover,
|
|
3063
|
-
createTime: item.publish_info.appmsg_info[0].line_info.send_time,
|
|
3064
|
-
redirectUrl: item.publish_info.appmsg_info[0].content_url,
|
|
3065
|
-
readNum: item.publish_info.appmsg_info[0].read_num,
|
|
3066
|
-
likeNum: item.publish_info.appmsg_info[0].old_like_num,
|
|
3067
|
-
shareNum: item.publish_info.appmsg_info[0].share_num,
|
|
3068
|
-
recommendNum: item.publish_info.appmsg_info[0].like_num,
|
|
3069
|
-
...showOriginalData ? {
|
|
3070
|
-
originalData: item
|
|
3071
|
-
} : {}
|
|
3072
|
-
}));
|
|
3073
|
-
return (0, share_.success)({
|
|
3074
|
-
articleCell,
|
|
3075
|
-
...onlySuccess ? {
|
|
3076
|
-
pagination: {
|
|
3077
|
-
total: articlesInfo?.total_count,
|
|
3078
|
-
pageNum,
|
|
3079
|
-
pageSize
|
|
3080
|
-
}
|
|
3081
|
-
} : null
|
|
3082
|
-
}, "微信文章获取成功");
|
|
2791
|
+
})
|
|
2792
|
+
]);
|
|
2793
|
+
const bjhData = {
|
|
2794
|
+
fansNum: fansData.data.coreData.fansCount,
|
|
2795
|
+
fansNumYesterday: -1 == yesterdayData.data.data.fans_increase ? null : yesterdayData.data.data.fans_increase,
|
|
2796
|
+
readNum: readData.data.total.view_count,
|
|
2797
|
+
incomeNum: incomeData.data.all_income.total_income,
|
|
2798
|
+
incomeNumYesterday: -1 == incomeData.data.all_income.yesterday_income ? null : incomeData.data.all_income.yesterday_income,
|
|
2799
|
+
recommendNumYesterday: -1 == yesterdayData.data.data.recommend_count ? null : yesterdayData.data.data.recommend_count,
|
|
2800
|
+
readNumYesterday: -1 == yesterdayData.data.data.view_count ? null : yesterdayData.data.data.view_count,
|
|
2801
|
+
likeNumYesterday: -1 == yesterdayData.data.data.likes_count ? null : yesterdayData.data.data.likes_count,
|
|
2802
|
+
commentNumYesterday: -1 == yesterdayData.data.data.comment_count ? null : yesterdayData.data.data.comment_count
|
|
2803
|
+
};
|
|
2804
|
+
return (0, share_.success)(bjhData, "百家号粉丝数据获取成功!");
|
|
2805
|
+
} catch (error) {
|
|
2806
|
+
return (0, types.V)(error instanceof Error ? error.message : "百家号数据获取失败");
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
async function getToutiaoData(params) {
|
|
2810
|
+
const { cookies } = params;
|
|
2811
|
+
try {
|
|
2812
|
+
const http = new utils_http.e({
|
|
2813
|
+
headers: {
|
|
2814
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2815
|
+
referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
|
|
2816
|
+
}
|
|
2817
|
+
});
|
|
2818
|
+
const [totalData, fansDataYesterday, contentDataYesterday] = await Promise.all([
|
|
2819
|
+
http.api({
|
|
2820
|
+
method: "get",
|
|
2821
|
+
url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
|
|
2822
|
+
params: {
|
|
2823
|
+
app_id: 1231
|
|
3083
2824
|
}
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
};
|
|
3091
|
-
const http = new utils_http.e({
|
|
3092
|
-
headers: {
|
|
3093
|
-
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3094
|
-
token: token
|
|
3095
|
-
}
|
|
3096
|
-
});
|
|
3097
|
-
async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
|
|
3098
|
-
return await http.api({
|
|
3099
|
-
method: "get",
|
|
3100
|
-
url: "https://baijiahao.baidu.com/pcui/article/lists",
|
|
3101
|
-
params: {
|
|
3102
|
-
currentPage: pageNum,
|
|
3103
|
-
pageSize: pageSize,
|
|
3104
|
-
search: "",
|
|
3105
|
-
type: "",
|
|
3106
|
-
collection: onlySuccess ? "publish" : "",
|
|
3107
|
-
clearBeforeFetch: false,
|
|
3108
|
-
dynamic: 1
|
|
3109
|
-
}
|
|
3110
|
-
});
|
|
3111
|
-
}
|
|
3112
|
-
const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
|
|
3113
|
-
let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
|
|
3114
|
-
const totalPage = articleInfo.data.page?.totalPage || 1;
|
|
3115
|
-
let currentPage = pageNum + 1;
|
|
3116
|
-
const usedPages = new Set();
|
|
3117
|
-
while(filtered.length < pageSize && currentPage <= totalPage){
|
|
3118
|
-
if (usedPages.has(currentPage)) {
|
|
3119
|
-
currentPage++;
|
|
3120
|
-
continue;
|
|
3121
|
-
}
|
|
3122
|
-
const res = await fetchArticles(currentPage, pageSize, onlySuccess);
|
|
3123
|
-
usedPages.add(currentPage);
|
|
3124
|
-
const validItems = res.data.list.filter((item)=>"draft" !== item.status);
|
|
3125
|
-
filtered.push(...validItems);
|
|
3126
|
-
currentPage++;
|
|
3127
|
-
}
|
|
3128
|
-
const final = filtered.slice(0, pageSize);
|
|
3129
|
-
const articleCell = final.map((item)=>({
|
|
3130
|
-
title: item.title,
|
|
3131
|
-
imageUrl: JSON.parse(item.cover_images)[0].src,
|
|
3132
|
-
createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
|
|
3133
|
-
redirectUrl: item.url,
|
|
3134
|
-
recommendNum: item.rec_amount,
|
|
3135
|
-
collectNum: item.collection_amount,
|
|
3136
|
-
readNum: item.read_amount,
|
|
3137
|
-
likeNum: item.like_amount,
|
|
3138
|
-
commentNum: item.comment_amount,
|
|
3139
|
-
shareNum: item.share_amount,
|
|
3140
|
-
...showOriginalData ? {
|
|
3141
|
-
originalData: item
|
|
3142
|
-
} : {}
|
|
3143
|
-
}));
|
|
3144
|
-
return (0, share_.success)({
|
|
3145
|
-
articleCell,
|
|
3146
|
-
...onlySuccess ? {
|
|
3147
|
-
pagination: {
|
|
3148
|
-
total: articleInfo.data.page?.totalCount,
|
|
3149
|
-
pageNum,
|
|
3150
|
-
pageSize
|
|
3151
|
-
}
|
|
3152
|
-
} : null
|
|
3153
|
-
}, "百家号文章获取成功");
|
|
2825
|
+
}),
|
|
2826
|
+
http.api({
|
|
2827
|
+
method: "get",
|
|
2828
|
+
url: "https://mp.toutiao.com/mp/agw/statistic/v2/fans/latest_stat",
|
|
2829
|
+
params: {
|
|
2830
|
+
app_id: 1231
|
|
3154
2831
|
}
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
2832
|
+
}),
|
|
2833
|
+
http.api({
|
|
2834
|
+
method: "get",
|
|
2835
|
+
url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
|
|
2836
|
+
params: {
|
|
2837
|
+
type: 0,
|
|
2838
|
+
app_id: 1231
|
|
2839
|
+
}
|
|
2840
|
+
})
|
|
2841
|
+
]);
|
|
2842
|
+
const ttData = {
|
|
2843
|
+
fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
|
|
2844
|
+
fansNumYesterday: fansDataYesterday.fans_stat.change_count,
|
|
2845
|
+
readNum: Number(totalData.data.statistic.data.total_read_play_count),
|
|
2846
|
+
incomeNum: totalData.data.statistic.data.total_income,
|
|
2847
|
+
incomeNumYesterday: totalData.data.statistic.data.yesterday_income,
|
|
2848
|
+
showNumYesterday: contentDataYesterday.author_stat.consume_data.impression_count,
|
|
2849
|
+
readNumYesterday: contentDataYesterday.author_stat.consume_data.go_detail_count,
|
|
2850
|
+
likeNumYesterday: contentDataYesterday.author_stat.interaction_data.digg_count,
|
|
2851
|
+
commentNumYesterday: contentDataYesterday.author_stat.interaction_data.comment_count
|
|
2852
|
+
};
|
|
2853
|
+
return (0, share_.success)(ttData, "头条号粉丝数据获取成功!");
|
|
2854
|
+
} catch (error) {
|
|
2855
|
+
return (0, types.V)(error instanceof Error ? error.message : "头条号数据获取失败");
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
var getWxInfo = __webpack_require__("./src/actions/searchAccountInfo/getWxInfo.ts");
|
|
2859
|
+
class XsEncrypt {
|
|
2860
|
+
async encryptMD5(url) {
|
|
2861
|
+
return __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createHash("md5").update(url, "utf8").digest("hex");
|
|
2862
|
+
}
|
|
2863
|
+
async encryptText(text) {
|
|
2864
|
+
const textEncoded = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(text).toString("base64");
|
|
2865
|
+
const cipher = __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__["default"].createCipheriv("aes-128-cbc", new Uint8Array(this.keyBytes), new Uint8Array(this.iv));
|
|
2866
|
+
const ciphertext = cipher.update(textEncoded, "utf8", "base64");
|
|
2867
|
+
return ciphertext + cipher.final("base64");
|
|
2868
|
+
}
|
|
2869
|
+
async base64ToHex(encodedData) {
|
|
2870
|
+
const decodedData = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(encodedData, "base64");
|
|
2871
|
+
return decodedData.toString("hex");
|
|
2872
|
+
}
|
|
2873
|
+
async encryptPayload(payload, platform) {
|
|
2874
|
+
const hexPayload = await this.base64ToHex(payload);
|
|
2875
|
+
const obj = {
|
|
2876
|
+
signSvn: "56",
|
|
2877
|
+
signType: "x2",
|
|
2878
|
+
appID: platform,
|
|
2879
|
+
signVersion: "1",
|
|
2880
|
+
payload: hexPayload
|
|
2881
|
+
};
|
|
2882
|
+
const jsonString = JSON.stringify(obj, null, 0);
|
|
2883
|
+
return __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from(jsonString).toString("base64");
|
|
2884
|
+
}
|
|
2885
|
+
async encryptXs(url, a1, ts, platform = "xhs-pc-web") {
|
|
2886
|
+
const text = `x1=${await this.encryptMD5(`url=${url}`)};x2=0|0|0|1|0|0|1|0|0|0|1|0|0|0|0|1|0|0|0;x3=${a1};x4=${ts};`;
|
|
2887
|
+
return `XYW_${await this.encryptPayload(await this.encryptText(text), platform)}`;
|
|
2888
|
+
}
|
|
2889
|
+
dumps(...rest) {
|
|
2890
|
+
const [data, replacer = null, space = 0] = rest;
|
|
2891
|
+
return JSON.stringify(data, replacer, space).replace(/\n/g, "").replace(/":\s+"/g, '":"');
|
|
2892
|
+
}
|
|
2893
|
+
constructor(){
|
|
2894
|
+
this.words = [
|
|
2895
|
+
929260340,
|
|
2896
|
+
1633971297,
|
|
2897
|
+
895580464,
|
|
2898
|
+
925905270
|
|
2899
|
+
];
|
|
2900
|
+
this.keyBytes = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.concat(this.words.map((word)=>new Uint8Array(__WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from([
|
|
2901
|
+
word >> 24 & 0xff,
|
|
2902
|
+
word >> 16 & 0xff,
|
|
2903
|
+
word >> 8 & 0xff,
|
|
2904
|
+
0xff & word
|
|
2905
|
+
]))));
|
|
2906
|
+
this.iv = __WEBPACK_EXTERNAL_MODULE_node_buffer_fb286294__.Buffer.from("4uzjr7mbsibcaldp", "utf8");
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
async function getXiaohongshuData(params) {
|
|
2910
|
+
try {
|
|
2911
|
+
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
2912
|
+
if (!a1Cookie) return (0, types.V)("账号数据异常,请重新绑定账号后重试。", 200);
|
|
2913
|
+
const http = new utils_http.e({
|
|
2914
|
+
headers: {
|
|
2915
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
2916
|
+
referer: "https://creator.xiaohongshu.com",
|
|
2917
|
+
origin: "https://creator.xiaohongshu.com"
|
|
2918
|
+
}
|
|
2919
|
+
});
|
|
2920
|
+
const xsEncrypt = new XsEncrypt();
|
|
2921
|
+
const xt = Date.now().toString();
|
|
2922
|
+
const sevenDataUrl = "/api/galaxy/v2/creator/datacenter/account/base";
|
|
2923
|
+
const xs = await xsEncrypt.encryptXs(sevenDataUrl, a1Cookie, xt);
|
|
2924
|
+
const [overAllData, sevenData] = await Promise.all([
|
|
2925
|
+
http.api({
|
|
2926
|
+
method: "get",
|
|
2927
|
+
url: "https://creator.xiaohongshu.com/api/galaxy/creator/home/personal_info"
|
|
2928
|
+
}),
|
|
2929
|
+
http.api({
|
|
2930
|
+
method: "get",
|
|
2931
|
+
baseURL: "https://creator.xiaohongshu.com",
|
|
2932
|
+
url: sevenDataUrl,
|
|
2933
|
+
headers: {
|
|
2934
|
+
"x-s": xs,
|
|
2935
|
+
"x-t": xt
|
|
2936
|
+
}
|
|
2937
|
+
})
|
|
2938
|
+
]);
|
|
2939
|
+
const xhsData = {
|
|
2940
|
+
fansNum: overAllData.data.fans_count,
|
|
2941
|
+
favedNum: overAllData.data.faved_count,
|
|
2942
|
+
watchNumLastWeek: sevenData.data.seven.view_count,
|
|
2943
|
+
likeNumLastWeek: sevenData.data.seven.like_count,
|
|
2944
|
+
collectNumLastWeek: sevenData.data.seven.collect_count,
|
|
2945
|
+
commentNumLastWeek: sevenData.data.seven.comment_count,
|
|
2946
|
+
fansNumLastWeek: sevenData.data.seven.rise_fans_count,
|
|
2947
|
+
fansNumYesterday: sevenData.data.seven.rise_fans_list[0].count
|
|
2948
|
+
};
|
|
2949
|
+
return (0, share_.success)(xhsData, "小红书粉丝数据获取成功!");
|
|
2950
|
+
} catch (error) {
|
|
2951
|
+
return (0, types.V)(error instanceof Error ? error.message : "小红书数据获取失败");
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
const SearchAccountInfo = async (_task, params)=>{
|
|
2955
|
+
const { platform } = params;
|
|
2956
|
+
switch(platform){
|
|
2957
|
+
case "toutiao":
|
|
2958
|
+
return getToutiaoData(params);
|
|
2959
|
+
case "xiaohongshu":
|
|
2960
|
+
return getXiaohongshuData(params);
|
|
2961
|
+
case "weixin":
|
|
2962
|
+
return (0, getWxInfo.n)(params);
|
|
2963
|
+
case "baijiahao":
|
|
2964
|
+
return getBaijiahaoData(params);
|
|
2965
|
+
default:
|
|
2966
|
+
return (0, share_.success)(null, "暂不支持该平台");
|
|
2967
|
+
}
|
|
2968
|
+
};
|
|
2969
|
+
const errorResponse = (message, code = 500)=>({
|
|
2970
|
+
code,
|
|
2971
|
+
message,
|
|
2972
|
+
data: null
|
|
2973
|
+
});
|
|
2974
|
+
async function handleToutiaoData(params) {
|
|
2975
|
+
try {
|
|
2976
|
+
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
2977
|
+
const http = new utils_http.e({
|
|
2978
|
+
headers: {
|
|
2979
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
2980
|
+
}
|
|
2981
|
+
});
|
|
2982
|
+
const visitedUid = await http.api({
|
|
2983
|
+
url: "https://mp.toutiao.com/mp/agw/creator_center/user_info?",
|
|
2984
|
+
method: "get",
|
|
2985
|
+
params: {
|
|
2986
|
+
app_id: 1231
|
|
2987
|
+
}
|
|
2988
|
+
});
|
|
2989
|
+
const articleInfo = await http.api({
|
|
2990
|
+
method: "get",
|
|
2991
|
+
url: "https://mp.toutiao.com/api/feed/mp_provider/v1/",
|
|
2992
|
+
params: {
|
|
2993
|
+
provider_type: "mp_provider",
|
|
2994
|
+
aid: "13",
|
|
2995
|
+
app_name: "news_article",
|
|
2996
|
+
category: "mp_all",
|
|
2997
|
+
channel: "",
|
|
2998
|
+
stream_api_version: "88",
|
|
2999
|
+
genre_type_switch: '{"repost":1,"small_video":1,"toutiao_graphic":1,"weitoutiao":1,"xigua_video":1}',
|
|
3000
|
+
device_platform: "pc",
|
|
3001
|
+
platform_id: "0",
|
|
3002
|
+
visited_uid: visitedUid.user_id_str,
|
|
3003
|
+
offset: (pageNum - 1) * pageSize,
|
|
3004
|
+
count: pageSize,
|
|
3005
|
+
keyword: "",
|
|
3006
|
+
client_extra_params: `{"category":"mp_all","real_app_id":"1231","need_forward":"true","offset_mode":"1","page_index":"1","status":${onlySuccess ? "2" : "8"},"source":"0"}`,
|
|
3007
|
+
app_id: "1231"
|
|
3008
|
+
}
|
|
3009
|
+
});
|
|
3010
|
+
const articleCell = articleInfo.data.map((item)=>({
|
|
3011
|
+
title: item.assembleCell.itemCell.articleBase.title,
|
|
3012
|
+
imageUrl: item.assembleCell.itemCell.imageList.staggerFeedCover[0].url,
|
|
3013
|
+
createTime: item.assembleCell.itemCell.articleBase.publishTime,
|
|
3014
|
+
redirectUrl: item.assembleCell.itemCell.articleBase.articleURL,
|
|
3015
|
+
showNum: item.assembleCell.itemCell.itemCounter.showCount,
|
|
3016
|
+
readNum: item.assembleCell.itemCell.itemCounter.readCount,
|
|
3017
|
+
likeNum: item.assembleCell.itemCell.itemCounter.diggCount,
|
|
3018
|
+
commentNum: item.assembleCell.itemCell.itemCounter.commentCount,
|
|
3019
|
+
...showOriginalData ? {
|
|
3020
|
+
originalData: item
|
|
3021
|
+
} : {}
|
|
3022
|
+
}));
|
|
3023
|
+
const api_base_info_json = JSON.parse(articleInfo.api_base_info.app_extra_params);
|
|
3024
|
+
return (0, share_.success)({
|
|
3025
|
+
articleCell,
|
|
3026
|
+
...onlySuccess ? {
|
|
3027
|
+
pagination: {
|
|
3028
|
+
total: api_base_info_json.total_count || -1,
|
|
3029
|
+
pageNum,
|
|
3030
|
+
pageSize
|
|
3031
|
+
}
|
|
3032
|
+
} : null
|
|
3033
|
+
}, "头条号文章获取成功");
|
|
3034
|
+
} catch (error) {
|
|
3035
|
+
return errorResponse(error instanceof Error ? error.message : "头条号数据获取失败");
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
async function handleWeixinData(params) {
|
|
3039
|
+
try {
|
|
3040
|
+
const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3041
|
+
if (!token) return {
|
|
3042
|
+
code: 200,
|
|
3043
|
+
message: "缺少token",
|
|
3044
|
+
data: null
|
|
3045
|
+
};
|
|
3046
|
+
const http = new utils_http.e({
|
|
3047
|
+
headers: {
|
|
3048
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";")
|
|
3049
|
+
}
|
|
3050
|
+
});
|
|
3051
|
+
const ParsePublishPage = (body)=>{
|
|
3052
|
+
const decodeHtml = (str)=>str.replace(/"/g, '"').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/'/g, "'").replace(/ /g, ' ');
|
|
3053
|
+
const match = body.match(/publish_page\s*=\s*(\{[\s\S]*?\})\s*;/);
|
|
3054
|
+
if (!match) throw new Error('无法提取 publish_page 字段');
|
|
3055
|
+
const rawPublishPageStr = match[1];
|
|
3056
|
+
const parsedData = JSON.parse(rawPublishPageStr);
|
|
3057
|
+
const finalData = {
|
|
3058
|
+
...parsedData,
|
|
3059
|
+
publish_list: parsedData.publish_list.map((item)=>{
|
|
3060
|
+
const decoded = decodeHtml(item.publish_info);
|
|
3061
|
+
const parsedInfo = JSON.parse(decoded);
|
|
3062
|
+
return {
|
|
3063
|
+
publish_type: item.publish_type,
|
|
3064
|
+
publish_info: parsedInfo
|
|
3168
3065
|
};
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
pagination: {
|
|
3206
|
-
total: articleInfo.data.tags[0].notes_count,
|
|
3207
|
-
pageNum,
|
|
3208
|
-
pageSize
|
|
3209
|
-
}
|
|
3210
|
-
} : null
|
|
3211
|
-
}, "小红书文章获取成功");
|
|
3066
|
+
})
|
|
3067
|
+
};
|
|
3068
|
+
return finalData;
|
|
3069
|
+
};
|
|
3070
|
+
const rawArticlesInfo = await http.api({
|
|
3071
|
+
method: "get",
|
|
3072
|
+
url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish',
|
|
3073
|
+
params: {
|
|
3074
|
+
sub: "list",
|
|
3075
|
+
begin: (pageNum - 1) * pageSize,
|
|
3076
|
+
count: pageSize,
|
|
3077
|
+
token: token,
|
|
3078
|
+
lang: "zh_CN"
|
|
3079
|
+
}
|
|
3080
|
+
});
|
|
3081
|
+
const articlesInfo = ParsePublishPage(rawArticlesInfo);
|
|
3082
|
+
const articleCell = articlesInfo?.publish_list.map((item)=>({
|
|
3083
|
+
title: item.publish_info.appmsg_info[0].title,
|
|
3084
|
+
imageUrl: item.publish_info.appmsg_info[0].cover,
|
|
3085
|
+
createTime: item.publish_info.appmsg_info[0].line_info.send_time,
|
|
3086
|
+
redirectUrl: item.publish_info.appmsg_info[0].content_url,
|
|
3087
|
+
readNum: item.publish_info.appmsg_info[0].read_num,
|
|
3088
|
+
likeNum: item.publish_info.appmsg_info[0].old_like_num,
|
|
3089
|
+
shareNum: item.publish_info.appmsg_info[0].share_num,
|
|
3090
|
+
recommendNum: item.publish_info.appmsg_info[0].like_num,
|
|
3091
|
+
...showOriginalData ? {
|
|
3092
|
+
originalData: item
|
|
3093
|
+
} : {}
|
|
3094
|
+
}));
|
|
3095
|
+
return (0, share_.success)({
|
|
3096
|
+
articleCell,
|
|
3097
|
+
...onlySuccess ? {
|
|
3098
|
+
pagination: {
|
|
3099
|
+
total: articlesInfo?.total_count,
|
|
3100
|
+
pageNum,
|
|
3101
|
+
pageSize
|
|
3212
3102
|
}
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3103
|
+
} : null
|
|
3104
|
+
}, "微信文章获取成功");
|
|
3105
|
+
} catch (error) {
|
|
3106
|
+
return errorResponse(error instanceof Error ? error.message : "微信数据获取失败");
|
|
3107
|
+
}
|
|
3108
|
+
}
|
|
3109
|
+
async function handleBaijiahaoData(params) {
|
|
3110
|
+
try {
|
|
3111
|
+
const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3112
|
+
if (!token) return {
|
|
3113
|
+
code: 200,
|
|
3114
|
+
message: "缺少token",
|
|
3115
|
+
data: null
|
|
3116
|
+
};
|
|
3117
|
+
const http = new utils_http.e({
|
|
3118
|
+
headers: {
|
|
3119
|
+
cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3120
|
+
token: token
|
|
3121
|
+
}
|
|
3122
|
+
});
|
|
3123
|
+
async function fetchArticles(pageNum, pageSize, onlySuccess = false) {
|
|
3124
|
+
return await http.api({
|
|
3125
|
+
method: "get",
|
|
3126
|
+
url: "https://baijiahao.baidu.com/pcui/article/lists",
|
|
3127
|
+
params: {
|
|
3128
|
+
currentPage: pageNum,
|
|
3129
|
+
pageSize: pageSize,
|
|
3130
|
+
search: "",
|
|
3131
|
+
type: "",
|
|
3132
|
+
collection: onlySuccess ? "publish" : "",
|
|
3133
|
+
clearBeforeFetch: false,
|
|
3134
|
+
dynamic: 1
|
|
3135
|
+
}
|
|
3136
|
+
});
|
|
3137
|
+
}
|
|
3138
|
+
const articleInfo = await fetchArticles(pageNum, pageSize, onlySuccess);
|
|
3139
|
+
let filtered = articleInfo.data.list.filter((item)=>"draft" !== item.status);
|
|
3140
|
+
const totalPage = articleInfo.data.page?.totalPage || 1;
|
|
3141
|
+
let currentPage = pageNum + 1;
|
|
3142
|
+
const usedPages = new Set();
|
|
3143
|
+
while(filtered.length < pageSize && currentPage <= totalPage){
|
|
3144
|
+
if (usedPages.has(currentPage)) {
|
|
3145
|
+
currentPage++;
|
|
3146
|
+
continue;
|
|
3147
|
+
}
|
|
3148
|
+
const res = await fetchArticles(currentPage, pageSize, onlySuccess);
|
|
3149
|
+
usedPages.add(currentPage);
|
|
3150
|
+
const validItems = res.data.list.filter((item)=>"draft" !== item.status);
|
|
3151
|
+
filtered.push(...validItems);
|
|
3152
|
+
currentPage++;
|
|
3219
3153
|
}
|
|
3154
|
+
const final = filtered.slice(0, pageSize);
|
|
3155
|
+
const articleCell = final.map((item)=>({
|
|
3156
|
+
title: item.title,
|
|
3157
|
+
imageUrl: JSON.parse(item.cover_images)[0].src,
|
|
3158
|
+
createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
|
|
3159
|
+
redirectUrl: item.url,
|
|
3160
|
+
recommendNum: item.rec_amount,
|
|
3161
|
+
collectNum: item.collection_amount,
|
|
3162
|
+
readNum: item.read_amount,
|
|
3163
|
+
likeNum: item.like_amount,
|
|
3164
|
+
commentNum: item.comment_amount,
|
|
3165
|
+
shareNum: item.share_amount,
|
|
3166
|
+
...showOriginalData ? {
|
|
3167
|
+
originalData: item
|
|
3168
|
+
} : {}
|
|
3169
|
+
}));
|
|
3170
|
+
return (0, share_.success)({
|
|
3171
|
+
articleCell,
|
|
3172
|
+
...onlySuccess ? {
|
|
3173
|
+
pagination: {
|
|
3174
|
+
total: articleInfo.data.page?.totalCount,
|
|
3175
|
+
pageNum,
|
|
3176
|
+
pageSize
|
|
3177
|
+
}
|
|
3178
|
+
} : null
|
|
3179
|
+
}, "百家号文章获取成功");
|
|
3220
3180
|
} catch (error) {
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3181
|
+
return errorResponse(error instanceof Error ? error.message : "百家号数据获取失败");
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
async function handleXiaohongshuData(params) {
|
|
3185
|
+
try {
|
|
3186
|
+
const { cookies, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
|
|
3187
|
+
const xsEncrypt = new XsEncrypt();
|
|
3188
|
+
const a1Cookie = cookies.find((it)=>"a1" === it.name)?.value;
|
|
3189
|
+
if (!a1Cookie) return {
|
|
3190
|
+
code: 200,
|
|
3191
|
+
message: "账号数据异常",
|
|
3225
3192
|
data: null
|
|
3226
3193
|
};
|
|
3194
|
+
if (onlySuccess && 10 != pageSize) return {
|
|
3195
|
+
code: 200,
|
|
3196
|
+
message: "小红书pageSize不可修改",
|
|
3197
|
+
data: null
|
|
3198
|
+
};
|
|
3199
|
+
const http = new utils_http.e({
|
|
3200
|
+
headers: {
|
|
3201
|
+
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
3202
|
+
referer: "https://creator.xiaohongshu.com",
|
|
3203
|
+
origin: "https://creator.xiaohongshu.com"
|
|
3204
|
+
}
|
|
3205
|
+
});
|
|
3206
|
+
async function fetchArticles(pageNum, a1Cookie, onlySuccess = false) {
|
|
3207
|
+
const xt = Date.now().toString();
|
|
3208
|
+
const serveUrl = `/web_api/sns/v5/creator/note/user/posted?tab=${onlySuccess ? 1 : 0}&page=${pageNum - 1}`;
|
|
3209
|
+
const xs = await xsEncrypt.encryptXs(serveUrl, a1Cookie, xt);
|
|
3210
|
+
return await http.api({
|
|
3211
|
+
method: "get",
|
|
3212
|
+
baseURL: "https://edith.xiaohongshu.com",
|
|
3213
|
+
url: serveUrl,
|
|
3214
|
+
headers: {
|
|
3215
|
+
"x-s": xs,
|
|
3216
|
+
"x-t": xt
|
|
3217
|
+
}
|
|
3218
|
+
});
|
|
3219
|
+
}
|
|
3220
|
+
const articleInfo = await fetchArticles(pageNum, a1Cookie, onlySuccess);
|
|
3221
|
+
let hasNextpage = -1 != articleInfo.data.page;
|
|
3222
|
+
let filtered = articleInfo.data.notes;
|
|
3223
|
+
let currentPage = pageNum + 1;
|
|
3224
|
+
const usedPages = new Set();
|
|
3225
|
+
while(filtered.length < pageSize && hasNextpage){
|
|
3226
|
+
if (usedPages.has(currentPage)) {
|
|
3227
|
+
currentPage++;
|
|
3228
|
+
continue;
|
|
3229
|
+
}
|
|
3230
|
+
const res = await fetchArticles(currentPage, a1Cookie, onlySuccess);
|
|
3231
|
+
usedPages.add(currentPage);
|
|
3232
|
+
const validItems = res.data.notes;
|
|
3233
|
+
filtered.push(...validItems);
|
|
3234
|
+
currentPage++;
|
|
3235
|
+
hasNextpage = -1 != res.data.page;
|
|
3236
|
+
}
|
|
3237
|
+
const final = filtered.slice(0, pageSize);
|
|
3238
|
+
const articleCell = final.map((item)=>({
|
|
3239
|
+
title: item.display_title,
|
|
3240
|
+
imageUrl: item.images_list[0].url,
|
|
3241
|
+
createTime: Math.floor(new Date(item.time.replace(/-/g, "/")).getTime() / 1000),
|
|
3242
|
+
redirectUrl: `https://www.xiaohongshu.com/explore/${item.id}?xsec_token=${item.xsec_token}&xsec_source=pc_creatormng`,
|
|
3243
|
+
readNum: item.view_count,
|
|
3244
|
+
likeNum: item.likes,
|
|
3245
|
+
commentNum: item.comments_count,
|
|
3246
|
+
collectNum: item.collected_count,
|
|
3247
|
+
shareNum: item.shared_count,
|
|
3248
|
+
...showOriginalData ? {
|
|
3249
|
+
originalData: item
|
|
3250
|
+
} : {}
|
|
3251
|
+
}));
|
|
3252
|
+
return (0, share_.success)({
|
|
3253
|
+
articleCell,
|
|
3254
|
+
...onlySuccess ? {
|
|
3255
|
+
pagination: {
|
|
3256
|
+
total: articleInfo.data.tags[0]?.notes_count || -1,
|
|
3257
|
+
pageNum,
|
|
3258
|
+
pageSize
|
|
3259
|
+
}
|
|
3260
|
+
} : null
|
|
3261
|
+
}, "小红书文章获取成功");
|
|
3262
|
+
} catch (error) {
|
|
3263
|
+
return errorResponse(error instanceof Error ? error.message : "小红书数据获取失败");
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
const FetchArticles = async (_task, params)=>{
|
|
3267
|
+
const { platform } = params;
|
|
3268
|
+
switch(platform){
|
|
3269
|
+
case "toutiao":
|
|
3270
|
+
return handleToutiaoData(params);
|
|
3271
|
+
case "weixin":
|
|
3272
|
+
return handleWeixinData(params);
|
|
3273
|
+
case "baijiahao":
|
|
3274
|
+
return handleBaijiahaoData(params);
|
|
3275
|
+
case "xiaohongshu":
|
|
3276
|
+
return handleXiaohongshuData(params);
|
|
3277
|
+
default:
|
|
3278
|
+
return (0, share_.success)(null, "暂不支持该平台");
|
|
3227
3279
|
}
|
|
3228
3280
|
};
|
|
3229
3281
|
const getWeixinConfig = async (_task, params)=>{
|
|
@@ -4778,7 +4830,7 @@ const xiaohongshuPublish_mock_errnoMap = {
|
|
|
4778
4830
|
903: "账户已登出,需重新登陆重试!",
|
|
4779
4831
|
902: "登录已过期,请重新登录!"
|
|
4780
4832
|
};
|
|
4781
|
-
const mock_xsEncrypt = new
|
|
4833
|
+
const mock_xsEncrypt = new XsEncrypt();
|
|
4782
4834
|
const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
4783
4835
|
const tmpCachePath = task.getTmpPath();
|
|
4784
4836
|
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
@@ -4967,7 +5019,7 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
|
|
|
4967
5019
|
});
|
|
4968
5020
|
return (0, share_.success)(publishResult.data?.id);
|
|
4969
5021
|
};
|
|
4970
|
-
const rpa_xsEncrypt = new
|
|
5022
|
+
const rpa_xsEncrypt = new XsEncrypt();
|
|
4971
5023
|
const xiaohongshuPublish_rpa_rpaAction = async (task, params)=>{
|
|
4972
5024
|
const commonCookies = {
|
|
4973
5025
|
path: "/",
|
|
@@ -5182,7 +5234,7 @@ const xiaohongshuPublish = async (task, params)=>{
|
|
|
5182
5234
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
5183
5235
|
return (0, utils.jo)(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
5184
5236
|
};
|
|
5185
|
-
var package_namespaceObject = JSON.parse('{"i8":"1.2.14-beta.
|
|
5237
|
+
var package_namespaceObject = JSON.parse('{"i8":"1.2.14-beta.2"}');
|
|
5186
5238
|
class Action {
|
|
5187
5239
|
constructor(task){
|
|
5188
5240
|
this.task = task;
|
|
@@ -5207,7 +5259,7 @@ class Action {
|
|
|
5207
5259
|
return this.bindTask(FetchArticles, params);
|
|
5208
5260
|
}
|
|
5209
5261
|
SearchAccountInfo(params) {
|
|
5210
|
-
return this.bindTask(
|
|
5262
|
+
return this.bindTask(SearchAccountInfo, params);
|
|
5211
5263
|
}
|
|
5212
5264
|
TTSessionCheck(params) {
|
|
5213
5265
|
return this.bindTask(TTSessionCheck, params);
|