@ikenxuan/amagi 5.9.0 → 5.10.0
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/default/index.cjs +251 -51
- package/dist/default/index.d.cts +9208 -8285
- package/dist/default/index.d.ts +9208 -8285
- package/dist/default/index.js +251 -52
- package/package.json +1 -1
package/dist/default/index.cjs
CHANGED
|
@@ -294,19 +294,18 @@ const getDouyinDefaultConfig = (cookie, requestConfig) => {
|
|
|
294
294
|
*/
|
|
295
295
|
const getBilibiliDefaultConfig = (cookie, requestConfig) => {
|
|
296
296
|
const defHeaders = {
|
|
297
|
-
Accept: "
|
|
297
|
+
Accept: "application/json, text/plain, */*",
|
|
298
298
|
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
|
299
|
-
"
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
"Accept-Encoding": "gzip, deflate, br",
|
|
300
|
+
Origin: "https://www.bilibili.com",
|
|
301
|
+
Referer: "https://www.bilibili.com/",
|
|
302
|
+
Priority: "u=1, i",
|
|
303
|
+
"Sec-Ch-Ua": "\"Microsoft Edge\";v=\"141\", \"Chromium\";v=\"141\", \"Not_A Brand\";v=\"24\"",
|
|
302
304
|
"Sec-Ch-Ua-Mobile": "?0",
|
|
303
305
|
"Sec-Ch-Ua-Platform": "\"Windows\"",
|
|
304
|
-
"Sec-Fetch-Dest": "
|
|
305
|
-
"Sec-Fetch-Mode": "
|
|
306
|
-
"Sec-Fetch-Site": "
|
|
307
|
-
"Sec-Fetch-User": "?1",
|
|
308
|
-
"Upgrade-Insecure-Requests": "1",
|
|
309
|
-
Referer: "https://www.bilibili.com/",
|
|
306
|
+
"Sec-Fetch-Dest": "empty",
|
|
307
|
+
"Sec-Fetch-Mode": "cors",
|
|
308
|
+
"Sec-Fetch-Site": "same-site",
|
|
310
309
|
Cookie: cookie ? cookie.replace(/\s+/g, "") : ""
|
|
311
310
|
};
|
|
312
311
|
return {
|
|
@@ -568,7 +567,7 @@ var BiLiBiLiAPI = class {
|
|
|
568
567
|
return `https://api.bilibili.com/pgc/player/web/playurl?cid=${data$1.cid}&ep_id=${data$1.ep_id}`;
|
|
569
568
|
}
|
|
570
569
|
用户空间动态(data$1) {
|
|
571
|
-
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?host_mid=${data$1.host_mid}&features=itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote,forwardListHidden,decorationCard,commentsNewVersion,onlyfansAssetsV2,ugcDelete,onlyfansQaCard`;
|
|
570
|
+
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?host_mid=${data$1.host_mid}&dm_img_switch=0&&features=itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote,forwardListHidden,decorationCard,commentsNewVersion,onlyfansAssetsV2,ugcDelete,onlyfansQaCard`;
|
|
572
571
|
}
|
|
573
572
|
动态详情(data$1) {
|
|
574
573
|
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?id=${data$1.dynamic_id}&features=itemOpusStyle,opusBigCover,onlyfansVote,endFooterHidden,decorationCard,onlyfansAssetsV2,ugcDelete,onlyfansQaCard,editable,opusPrivateVisible,avatarAutoTheme`;
|
|
@@ -1190,9 +1189,18 @@ const DouyinCommentParamsSchema = zod.default.object({
|
|
|
1190
1189
|
number: smartPositiveInteger("评论数量必须是正整数").optional().default(50),
|
|
1191
1190
|
cursor: zod.default.coerce.number({ error: "游标必须是数字" }).int({ error: "游标必须是整数" }).min(0, { error: "游标不能小于0" }).default(0).optional()
|
|
1192
1191
|
});
|
|
1192
|
+
const DouyinHotWordsParamsSchema = zod.default.object({
|
|
1193
|
+
methodType: zod.default.literal("热点词数据", { error: "方法类型必须是\"热点词数据\"" }),
|
|
1194
|
+
query: zod.default.string({ error: "搜索词必须是字符串" }).min(1, { error: "搜索词不能为空" })
|
|
1195
|
+
});
|
|
1193
1196
|
const DouyinSearchParamsSchema = zod.default.object({
|
|
1194
|
-
methodType: zod.default.
|
|
1197
|
+
methodType: zod.default.literal("搜索数据", { error: "方法类型必须是\"搜索数据\"" }),
|
|
1195
1198
|
query: zod.default.string({ error: "搜索词必须是字符串" }).min(1, { error: "搜索词不能为空" }),
|
|
1199
|
+
type: zod.default.enum([
|
|
1200
|
+
"综合",
|
|
1201
|
+
"用户",
|
|
1202
|
+
"视频"
|
|
1203
|
+
], { error: "搜索类型必须是\"综合\"、\"用户\"或\"视频\"" }).optional().default("综合"),
|
|
1196
1204
|
number: smartPositiveInteger("搜索数量必须是正整数").optional().default(10),
|
|
1197
1205
|
search_id: zod.default.string({ error: "搜索ID必须是字符串" }).optional()
|
|
1198
1206
|
});
|
|
@@ -1250,7 +1258,7 @@ const DouyinValidationSchemas = {
|
|
|
1250
1258
|
评论数据: DouyinCommentParamsSchema,
|
|
1251
1259
|
用户主页数据: DouyinUserParamsSchema,
|
|
1252
1260
|
用户主页视频列表数据: DouyinUserParamsSchema,
|
|
1253
|
-
热点词数据:
|
|
1261
|
+
热点词数据: DouyinHotWordsParamsSchema,
|
|
1254
1262
|
搜索数据: DouyinSearchParamsSchema,
|
|
1255
1263
|
音乐数据: DouyinMusicParamsSchema,
|
|
1256
1264
|
直播间信息数据: DouyinLiveRoomParamsSchema,
|
|
@@ -1897,7 +1905,7 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
1897
1905
|
timeout: 1e4,
|
|
1898
1906
|
...requestConfig,
|
|
1899
1907
|
headers: {
|
|
1900
|
-
|
|
1908
|
+
Referer: "https://www.bilibili.com/",
|
|
1901
1909
|
...defHeaders,
|
|
1902
1910
|
...requestConfig?.headers ?? {}
|
|
1903
1911
|
}
|
|
@@ -2014,17 +2022,19 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2014
2022
|
});
|
|
2015
2023
|
}
|
|
2016
2024
|
case "用户主页动态列表数据": {
|
|
2025
|
+
const { host_mid } = data$1;
|
|
2017
2026
|
const customConfig = {
|
|
2018
2027
|
...baseRequestConfig,
|
|
2019
2028
|
headers: {
|
|
2020
2029
|
...baseRequestConfig.headers,
|
|
2021
|
-
...
|
|
2030
|
+
...requestConfig?.headers && ("referer" in requestConfig.headers || "Referer" in requestConfig.headers) ? {} : { Referer: `https://space.bilibili.com/${host_mid}` },
|
|
2031
|
+
Origin: "https://space.bilibili.com"
|
|
2022
2032
|
}
|
|
2023
2033
|
};
|
|
2024
|
-
const { host_mid }
|
|
2034
|
+
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.用户空间动态({ host_mid }), baseRequestConfig.headers?.cookie);
|
|
2025
2035
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2026
2036
|
...customConfig,
|
|
2027
|
-
url: bilibiliApiUrls.用户空间动态({ host_mid })
|
|
2037
|
+
url: bilibiliApiUrls.用户空间动态({ host_mid }) + wbiSignQuery
|
|
2028
2038
|
});
|
|
2029
2039
|
}
|
|
2030
2040
|
case "动态详情数据": {
|
|
@@ -2154,7 +2164,8 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2154
2164
|
* @param options - 网络请求配置
|
|
2155
2165
|
* @returns
|
|
2156
2166
|
*/
|
|
2157
|
-
const GlobalGetData$3 = async (type, options) => {
|
|
2167
|
+
const GlobalGetData$3 = async (type, options, retryCount = 0) => {
|
|
2168
|
+
const MAX_RETRIES = 3;
|
|
2158
2169
|
let warningMessage = "";
|
|
2159
2170
|
try {
|
|
2160
2171
|
const result = await fetchData(options);
|
|
@@ -2179,11 +2190,13 @@ const GlobalGetData$3 = async (type, options) => {
|
|
|
2179
2190
|
throw riskError;
|
|
2180
2191
|
}
|
|
2181
2192
|
if (result.code !== 0 || !result.data || typeof result.data === "object" && Object.keys(result.data).length === 0) {
|
|
2193
|
+
if (result.code === -412 && retryCount < MAX_RETRIES) return await GlobalGetData$3(type, options, retryCount + 1);
|
|
2182
2194
|
const errorMessage = bilibiliErrorCodeMap[result.code] || typeof result.data === "object" && Object.keys(result.data).length === 0 && "请求成功但无返回内容" || (result.message ?? "未知错误");
|
|
2183
2195
|
const Err = {
|
|
2184
2196
|
errorDescription: `获取响应数据失败!原因:${errorMessage}!`,
|
|
2185
2197
|
requestType: type ?? "未知请求类型",
|
|
2186
|
-
requestUrl: options.url
|
|
2198
|
+
requestUrl: options.url,
|
|
2199
|
+
responseCode: result.code
|
|
2187
2200
|
};
|
|
2188
2201
|
warningMessage = `
|
|
2189
2202
|
获取响应数据失败!原因:${logger.yellow(errorMessage)}
|
|
@@ -3135,12 +3148,68 @@ var DouyinAPI = class {
|
|
|
3135
3148
|
}
|
|
3136
3149
|
/**
|
|
3137
3150
|
* 获取搜索数据的接口地址
|
|
3138
|
-
* @param data - 请求参数,包含query、number、search_id等
|
|
3151
|
+
* @param data - 请求参数,包含query、type、number、search_id等
|
|
3139
3152
|
* @returns 完整的接口URL
|
|
3140
3153
|
*/
|
|
3141
3154
|
搜索(data$1) {
|
|
3142
|
-
|
|
3143
|
-
|
|
3155
|
+
const searchType = data$1.type ?? "综合";
|
|
3156
|
+
const { verifyFp, fp: fp$1, ...baseParamsWithoutFp } = this.getBaseParams();
|
|
3157
|
+
if (searchType === "用户") return `https://www.douyin.com/aweme/v1/web/discover/search/?${buildQueryString({
|
|
3158
|
+
...baseParamsWithoutFp,
|
|
3159
|
+
count: data$1.number ?? 10,
|
|
3160
|
+
disable_rs: "0",
|
|
3161
|
+
from_group_id: "",
|
|
3162
|
+
is_filter_search: "0",
|
|
3163
|
+
keyword: data$1.query,
|
|
3164
|
+
list_type: "single",
|
|
3165
|
+
need_filter_settings: "1",
|
|
3166
|
+
offset: "0",
|
|
3167
|
+
pc_libra_divert: "Windows",
|
|
3168
|
+
pc_search_top_1_params: "{\"enable_ai_search_top_1\":1}",
|
|
3169
|
+
query_correct_type: "1",
|
|
3170
|
+
round_trip_time: "250",
|
|
3171
|
+
screen_height: "1310",
|
|
3172
|
+
screen_width: "2328",
|
|
3173
|
+
search_channel: "aweme_user_web",
|
|
3174
|
+
search_source: "switch_tab",
|
|
3175
|
+
support_dash: "1",
|
|
3176
|
+
support_h265: "1",
|
|
3177
|
+
version_code: "170400",
|
|
3178
|
+
version_name: "17.4.0",
|
|
3179
|
+
webid: "7521399115230610959",
|
|
3180
|
+
...data$1.search_id && { search_id: data$1.search_id }
|
|
3181
|
+
})}`;
|
|
3182
|
+
else if (searchType === "视频") {
|
|
3183
|
+
const baseUrl = "https://www.douyin.com/aweme/v1/web/search/item/";
|
|
3184
|
+
const { verifyFp: verifyFp$1, fp: fp$2, ...baseParamsWithoutFp$1 } = this.getBaseParams();
|
|
3185
|
+
return `${baseUrl}?${buildQueryString({
|
|
3186
|
+
...baseParamsWithoutFp$1,
|
|
3187
|
+
count: data$1.number ?? 10,
|
|
3188
|
+
disable_rs: "0",
|
|
3189
|
+
enable_history: "1",
|
|
3190
|
+
from_group_id: "",
|
|
3191
|
+
is_filter_search: "0",
|
|
3192
|
+
keyword: data$1.query,
|
|
3193
|
+
list_type: "single",
|
|
3194
|
+
need_filter_settings: "1",
|
|
3195
|
+
offset: "0",
|
|
3196
|
+
pc_libra_divert: "Windows",
|
|
3197
|
+
pc_search_top_1_params: "{\"enable_ai_search_top_1\":1}",
|
|
3198
|
+
query_correct_type: "1",
|
|
3199
|
+
round_trip_time: "50",
|
|
3200
|
+
screen_height: "1310",
|
|
3201
|
+
screen_width: "2328",
|
|
3202
|
+
search_channel: "aweme_video_web",
|
|
3203
|
+
search_source: "switch_tab",
|
|
3204
|
+
support_dash: "1",
|
|
3205
|
+
support_h265: "1",
|
|
3206
|
+
version_code: "170400",
|
|
3207
|
+
version_name: "17.4.0",
|
|
3208
|
+
webid: "7521399115230610959",
|
|
3209
|
+
...data$1.search_id && { search_id: data$1.search_id }
|
|
3210
|
+
})}`;
|
|
3211
|
+
} else return `https://www.douyin.com/aweme/v1/web/general/search/stream/?${buildQueryString({
|
|
3212
|
+
...baseParamsWithoutFp,
|
|
3144
3213
|
count: data$1.number ?? 10,
|
|
3145
3214
|
disable_rs: "0",
|
|
3146
3215
|
enable_history: "1",
|
|
@@ -3458,10 +3527,7 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3458
3527
|
});
|
|
3459
3528
|
}
|
|
3460
3529
|
case "热点词数据": {
|
|
3461
|
-
const url$1 = douyinApiUrls$1.热点词({
|
|
3462
|
-
query: data$1.query,
|
|
3463
|
-
number: data$1.number ?? 10
|
|
3464
|
-
});
|
|
3530
|
+
const url$1 = douyinApiUrls$1.热点词({ query: data$1.query });
|
|
3465
3531
|
const customConfig = {
|
|
3466
3532
|
...baseRequestConfig,
|
|
3467
3533
|
headers: {
|
|
@@ -3479,49 +3545,182 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3479
3545
|
const maxPageSize = 15;
|
|
3480
3546
|
let fetchedSearchList = [];
|
|
3481
3547
|
let tmpresp = null;
|
|
3548
|
+
const searchType = data$1.type ?? "综合";
|
|
3549
|
+
const refererUrl = searchType === "用户" ? `https://www.douyin.com/search/${encodeURIComponent(String(data$1.query))}?type=user` : searchType === "视频" ? `https://www.douyin.com/search/${encodeURIComponent(String(data$1.query))}?type=video` : `https://www.douyin.com/root/search/${encodeURIComponent(String(data$1.query))}`;
|
|
3482
3550
|
const customConfig = {
|
|
3483
3551
|
...baseRequestConfig,
|
|
3484
3552
|
headers: {
|
|
3485
3553
|
...baseRequestConfig.headers,
|
|
3486
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && {
|
|
3554
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { referer: refererUrl }
|
|
3487
3555
|
}
|
|
3488
3556
|
};
|
|
3557
|
+
const isUserSearch = searchType === "用户";
|
|
3558
|
+
const isVideoSearch = searchType === "视频";
|
|
3559
|
+
let isFirstRequest = true;
|
|
3489
3560
|
while (fetchedSearchList.length < Number(data$1.number ?? 10)) {
|
|
3490
3561
|
const requestCount = Math.min(Number(data$1.number ?? 50) - fetchedSearchList.length, maxPageSize);
|
|
3491
3562
|
const url$1 = douyinApiUrls$1.搜索({
|
|
3492
3563
|
query: data$1.query,
|
|
3564
|
+
type: data$1.type,
|
|
3493
3565
|
number: requestCount,
|
|
3494
3566
|
search_id: search_id === "" ? void 0 : search_id
|
|
3495
3567
|
});
|
|
3496
3568
|
const raw = await GlobalGetData$2(data$1.methodType, {
|
|
3497
3569
|
...customConfig,
|
|
3498
|
-
url:
|
|
3570
|
+
url: url$1
|
|
3499
3571
|
});
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3572
|
+
if (isUserSearch) {
|
|
3573
|
+
if (!raw || typeof raw !== "object") {
|
|
3574
|
+
const Err = {
|
|
3575
|
+
errorDescription: "抖音用户搜索返回无有效数据,疑似触发反爬机制,你的抖音Cookie可能已经失效!",
|
|
3576
|
+
requestType: data$1.methodType ?? "未知请求类型",
|
|
3577
|
+
requestUrl: url$1
|
|
3578
|
+
};
|
|
3579
|
+
const warningMessage = `
|
|
3580
|
+
获取响应数据失败!原因:${logger.yellow("用户搜索返回无有效数据,疑似触发反爬机制")}
|
|
3581
|
+
请求类型:「${data$1.methodType}」
|
|
3582
|
+
搜索关键词:「${data$1.query}」
|
|
3583
|
+
请求URL:${url$1}
|
|
3584
|
+
`;
|
|
3585
|
+
!isFirstRequest && logger.warn(warningMessage);
|
|
3586
|
+
return {
|
|
3587
|
+
code: douoyinAPIErrorCode.COOKIE,
|
|
3588
|
+
data: raw,
|
|
3589
|
+
amagiError: Err,
|
|
3590
|
+
amagiMessage: warningMessage
|
|
3591
|
+
};
|
|
3592
|
+
}
|
|
3593
|
+
const userList = raw.user_list;
|
|
3594
|
+
if (isFirstRequest && (!userList || userList.length === 0)) {
|
|
3595
|
+
const Err = {
|
|
3596
|
+
errorDescription: "抖音用户搜索接口第一次请求就返回空数组,可能该关键词无搜索结果或触发风控限制,你的抖音Cookie可能已经失效!",
|
|
3597
|
+
requestType: data$1.methodType ?? "未知请求类型",
|
|
3598
|
+
requestUrl: url$1
|
|
3599
|
+
};
|
|
3600
|
+
const warningMessage = `
|
|
3601
|
+
获取响应数据失败!原因:${logger.yellow("用户搜索接口第一次请求就返回空数组,你的抖音Cookie可能已经失效!")}
|
|
3602
|
+
请求类型:「${data$1.methodType}」
|
|
3603
|
+
搜索关键词:「${data$1.query}」
|
|
3604
|
+
请求URL:${url$1}
|
|
3605
|
+
`;
|
|
3606
|
+
logger.warn(warningMessage);
|
|
3607
|
+
return {
|
|
3608
|
+
data: raw,
|
|
3609
|
+
amagiError: Err,
|
|
3610
|
+
amagiMessage: warningMessage
|
|
3611
|
+
};
|
|
3612
|
+
}
|
|
3613
|
+
if (Array.isArray(userList) && userList.length > 0) fetchedSearchList.push(...userList);
|
|
3614
|
+
tmpresp = raw;
|
|
3615
|
+
search_id = raw.rid ?? search_id;
|
|
3616
|
+
if (typeof raw.has_more === "number" && raw.has_more === 0) break;
|
|
3617
|
+
if (!userList || userList.length === 0) break;
|
|
3618
|
+
} else if (isVideoSearch) {
|
|
3619
|
+
if (!raw || typeof raw !== "object") {
|
|
3620
|
+
const Err = {
|
|
3621
|
+
errorDescription: "抖音视频搜索接口返回无有效数据,疑似触发反爬机制,你的抖音Cookie可能已经失效,你的抖音Cookie可能已经失效!",
|
|
3622
|
+
requestType: data$1.methodType ?? "未知请求类型",
|
|
3623
|
+
requestUrl: url$1
|
|
3624
|
+
};
|
|
3625
|
+
const warningMessage = `
|
|
3626
|
+
获取响应数据失败!原因:${logger.yellow("视频搜索接口返回无有效数据,疑似触发反爬机制,你的抖音Cookie可能已经失效!")}
|
|
3627
|
+
请求类型:「${data$1.methodType}」
|
|
3628
|
+
搜索关键词:「${data$1.query}」
|
|
3629
|
+
请求URL:${url$1}
|
|
3630
|
+
`;
|
|
3631
|
+
!isFirstRequest && logger.warn(warningMessage);
|
|
3632
|
+
return {
|
|
3633
|
+
code: douoyinAPIErrorCode.COOKIE,
|
|
3634
|
+
data: raw,
|
|
3635
|
+
amagiError: Err,
|
|
3636
|
+
amagiMessage: warningMessage
|
|
3637
|
+
};
|
|
3638
|
+
}
|
|
3639
|
+
const videoList = raw.data;
|
|
3640
|
+
if (isFirstRequest && (!videoList || videoList.length === 0)) {
|
|
3641
|
+
const Err = {
|
|
3642
|
+
errorDescription: "抖音视频搜索接口第一次请求就返回空数组,可能该关键词无搜索结果或触发风控限制,你的抖音Cookie可能已经失效!",
|
|
3643
|
+
requestType: data$1.methodType ?? "未知请求类型",
|
|
3644
|
+
requestUrl: url$1
|
|
3645
|
+
};
|
|
3646
|
+
const warningMessage = `
|
|
3647
|
+
获取响应数据失败!原因:${logger.yellow("视频搜索接口第一次请求就返回空数组,你的抖音Cookie可能已经失效!")}
|
|
3648
|
+
请求类型:「${data$1.methodType}」
|
|
3649
|
+
搜索关键词:「${data$1.query}」
|
|
3650
|
+
请求URL:${url$1}
|
|
3651
|
+
`;
|
|
3652
|
+
logger.warn(warningMessage);
|
|
3653
|
+
return {
|
|
3654
|
+
data: raw,
|
|
3655
|
+
amagiError: Err,
|
|
3656
|
+
amagiMessage: warningMessage
|
|
3657
|
+
};
|
|
3658
|
+
}
|
|
3659
|
+
if (Array.isArray(videoList) && videoList.length > 0) fetchedSearchList.push(...videoList);
|
|
3660
|
+
tmpresp = raw;
|
|
3661
|
+
search_id = raw.log_pb?.impr_id ?? search_id;
|
|
3662
|
+
if (typeof raw.has_more === "number" && raw.has_more === 0) break;
|
|
3663
|
+
if (!videoList || videoList.length === 0) break;
|
|
3664
|
+
} else {
|
|
3665
|
+
const responses = filterSearchResponses(typeof raw === "string" ? parseDouyinMultiJson(raw) : [raw]);
|
|
3666
|
+
if (responses.length === 0) {
|
|
3667
|
+
const Err = {
|
|
3668
|
+
errorDescription: "抖音综合搜索接口返回无有效数据,疑似触发反爬机制,你的抖音Cookie可能已经失效!",
|
|
3669
|
+
requestType: data$1.methodType ?? "未知请求类型",
|
|
3670
|
+
requestUrl: url$1
|
|
3671
|
+
};
|
|
3672
|
+
const warningMessage = `
|
|
3673
|
+
获取响应数据失败!原因:${logger.yellow("综合搜索接口返回无有效数据,疑似触发反爬机制,你的抖音Cookie可能已经失效!")}
|
|
3674
|
+
请求类型:「${data$1.methodType}」
|
|
3675
|
+
搜索关键词:「${data$1.query}」
|
|
3676
|
+
请求URL:${url$1}
|
|
3677
|
+
`;
|
|
3678
|
+
!isFirstRequest && logger.warn(warningMessage);
|
|
3679
|
+
return {
|
|
3680
|
+
code: douoyinAPIErrorCode.COOKIE,
|
|
3681
|
+
data: raw,
|
|
3682
|
+
amagiError: Err,
|
|
3683
|
+
amagiMessage: warningMessage
|
|
3684
|
+
};
|
|
3685
|
+
}
|
|
3686
|
+
for (const resp of responses) {
|
|
3687
|
+
if (Array.isArray(resp.data) && resp.data.length > 0) fetchedSearchList.push(...resp.data);
|
|
3688
|
+
tmpresp = resp;
|
|
3689
|
+
search_id = resp.log_pb?.impr_id ?? search_id;
|
|
3690
|
+
}
|
|
3691
|
+
if (isFirstRequest && fetchedSearchList.length === 0) {
|
|
3692
|
+
const Err = {
|
|
3693
|
+
errorDescription: "抖音综合搜索接口第一次请求就返回空数组,可能该关键词无搜索结果或触发风控限制,你的抖音Cookie可能已经失效!",
|
|
3694
|
+
requestType: data$1.methodType ?? "未知请求类型",
|
|
3695
|
+
requestUrl: url$1
|
|
3696
|
+
};
|
|
3697
|
+
const warningMessage = `
|
|
3698
|
+
获取响应数据失败!原因:${logger.yellow("综合搜索索接第一次请求就返回空数组,你的抖音Cookie可能已经失效!")}
|
|
3699
|
+
请求类型:「${data$1.methodType}」
|
|
3700
|
+
搜索关键词:「${data$1.query}」
|
|
3701
|
+
请求URL:${url$1}
|
|
3702
|
+
`;
|
|
3703
|
+
logger.warn(warningMessage);
|
|
3704
|
+
return {
|
|
3705
|
+
data: raw,
|
|
3706
|
+
amagiError: Err,
|
|
3707
|
+
amagiMessage: warningMessage
|
|
3708
|
+
};
|
|
3709
|
+
}
|
|
3710
|
+
if (tmpresp && typeof tmpresp.has_more === "number" && tmpresp.has_more === 0) break;
|
|
3519
3711
|
}
|
|
3520
|
-
|
|
3712
|
+
isFirstRequest = false;
|
|
3521
3713
|
}
|
|
3522
|
-
|
|
3714
|
+
const slicedList = Number(data$1.number ?? 10) === 0 ? [] : fetchedSearchList.slice(0, Number(data$1.number ?? 10));
|
|
3715
|
+
return isUserSearch ? {
|
|
3716
|
+
...tmpresp ?? {},
|
|
3717
|
+
user_list: slicedList
|
|
3718
|
+
} : isVideoSearch ? {
|
|
3719
|
+
...tmpresp ?? {},
|
|
3720
|
+
data: slicedList
|
|
3721
|
+
} : {
|
|
3523
3722
|
...tmpresp ?? {},
|
|
3524
|
-
data:
|
|
3723
|
+
data: slicedList
|
|
3525
3724
|
};
|
|
3526
3725
|
}
|
|
3527
3726
|
case "动态表情数据": {
|
|
@@ -4771,7 +4970,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
4771
4970
|
|
|
4772
4971
|
//#endregion
|
|
4773
4972
|
//#region src/index.ts
|
|
4774
|
-
const VERSION = "5.
|
|
4973
|
+
const VERSION = "5.10.0";
|
|
4775
4974
|
/**
|
|
4776
4975
|
* @deprecated 请使用 createAmagiClient 替代
|
|
4777
4976
|
*/
|
|
@@ -4837,6 +5036,7 @@ exports.DouyinCommentReplyParamsSchema = DouyinCommentReplyParamsSchema;
|
|
|
4837
5036
|
exports.DouyinDanmakuParamsSchema = DouyinDanmakuParamsSchema;
|
|
4838
5037
|
exports.DouyinEmojiListParamsSchema = DouyinEmojiListParamsSchema;
|
|
4839
5038
|
exports.DouyinEmojiProParamsSchema = DouyinEmojiProParamsSchema;
|
|
5039
|
+
exports.DouyinHotWordsParamsSchema = DouyinHotWordsParamsSchema;
|
|
4840
5040
|
exports.DouyinLiveRoomParamsSchema = DouyinLiveRoomParamsSchema;
|
|
4841
5041
|
exports.DouyinMethodRoutes = DouyinMethodRoutes;
|
|
4842
5042
|
exports.DouyinMusicParamsSchema = DouyinMusicParamsSchema;
|