@ikenxuan/amagi 5.9.1 → 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 +249 -71
- package/dist/default/index.d.cts +9208 -8285
- package/dist/default/index.d.ts +9208 -8285
- package/dist/default/index.js +249 -72
- 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,14 +2022,15 @@ 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 } = data$1;
|
|
2025
2034
|
const wbiSignQuery = await wbi_sign(bilibiliApiUrls.用户空间动态({ host_mid }), baseRequestConfig.headers?.cookie);
|
|
2026
2035
|
return await GlobalGetData$3(data$1.methodType, {
|
|
2027
2036
|
...customConfig,
|
|
@@ -2155,31 +2164,11 @@ const fetchBilibili = async (data$1, cookie, requestConfig) => {
|
|
|
2155
2164
|
* @param options - 网络请求配置
|
|
2156
2165
|
* @returns
|
|
2157
2166
|
*/
|
|
2158
|
-
const GlobalGetData$3 = async (type, options) => {
|
|
2167
|
+
const GlobalGetData$3 = async (type, options, retryCount = 0) => {
|
|
2168
|
+
const MAX_RETRIES = 3;
|
|
2159
2169
|
let warningMessage = "";
|
|
2160
2170
|
try {
|
|
2161
2171
|
const result = await fetchData(options);
|
|
2162
|
-
if (typeof result === "string" && result.includes("<!DOCTYPE html>")) {
|
|
2163
|
-
const Err = {
|
|
2164
|
-
errorDescription: "触发B站风控策略,请求被拦截!可能原因:请求频率过高、Cookie失效、缺少必要请求头",
|
|
2165
|
-
requestType: type ?? "未知请求类型",
|
|
2166
|
-
requestUrl: options.url
|
|
2167
|
-
};
|
|
2168
|
-
warningMessage = `
|
|
2169
|
-
${logger.red("触发B站风控策略,请求被拦截")}
|
|
2170
|
-
请求类型:「${type}」
|
|
2171
|
-
请求URL:${options.url}
|
|
2172
|
-
建议:降低请求频率、检查Cookie
|
|
2173
|
-
`;
|
|
2174
|
-
logger.warn(warningMessage);
|
|
2175
|
-
const riskError = new Error(Err.errorDescription);
|
|
2176
|
-
Object.assign(riskError, {
|
|
2177
|
-
code: bilibiliAPIErrorCode.IP_BLOCKED,
|
|
2178
|
-
data: result,
|
|
2179
|
-
amagiError: Err
|
|
2180
|
-
});
|
|
2181
|
-
throw riskError;
|
|
2182
|
-
}
|
|
2183
2172
|
if (!result || result === "") {
|
|
2184
2173
|
const Err = {
|
|
2185
2174
|
errorDescription: "获取响应数据失败!接口返回内容为空,你的B站ck可能已经失效!",
|
|
@@ -2201,11 +2190,13 @@ const GlobalGetData$3 = async (type, options) => {
|
|
|
2201
2190
|
throw riskError;
|
|
2202
2191
|
}
|
|
2203
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);
|
|
2204
2194
|
const errorMessage = bilibiliErrorCodeMap[result.code] || typeof result.data === "object" && Object.keys(result.data).length === 0 && "请求成功但无返回内容" || (result.message ?? "未知错误");
|
|
2205
2195
|
const Err = {
|
|
2206
2196
|
errorDescription: `获取响应数据失败!原因:${errorMessage}!`,
|
|
2207
2197
|
requestType: type ?? "未知请求类型",
|
|
2208
|
-
requestUrl: options.url
|
|
2198
|
+
requestUrl: options.url,
|
|
2199
|
+
responseCode: result.code
|
|
2209
2200
|
};
|
|
2210
2201
|
warningMessage = `
|
|
2211
2202
|
获取响应数据失败!原因:${logger.yellow(errorMessage)}
|
|
@@ -3157,12 +3148,68 @@ var DouyinAPI = class {
|
|
|
3157
3148
|
}
|
|
3158
3149
|
/**
|
|
3159
3150
|
* 获取搜索数据的接口地址
|
|
3160
|
-
* @param data - 请求参数,包含query、number、search_id等
|
|
3151
|
+
* @param data - 请求参数,包含query、type、number、search_id等
|
|
3161
3152
|
* @returns 完整的接口URL
|
|
3162
3153
|
*/
|
|
3163
3154
|
搜索(data$1) {
|
|
3164
|
-
|
|
3165
|
-
|
|
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,
|
|
3166
3213
|
count: data$1.number ?? 10,
|
|
3167
3214
|
disable_rs: "0",
|
|
3168
3215
|
enable_history: "1",
|
|
@@ -3480,10 +3527,7 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3480
3527
|
});
|
|
3481
3528
|
}
|
|
3482
3529
|
case "热点词数据": {
|
|
3483
|
-
const url$1 = douyinApiUrls$1.热点词({
|
|
3484
|
-
query: data$1.query,
|
|
3485
|
-
number: data$1.number ?? 10
|
|
3486
|
-
});
|
|
3530
|
+
const url$1 = douyinApiUrls$1.热点词({ query: data$1.query });
|
|
3487
3531
|
const customConfig = {
|
|
3488
3532
|
...baseRequestConfig,
|
|
3489
3533
|
headers: {
|
|
@@ -3501,49 +3545,182 @@ const DouyinData = async (data$1, cookie, requestConfig) => {
|
|
|
3501
3545
|
const maxPageSize = 15;
|
|
3502
3546
|
let fetchedSearchList = [];
|
|
3503
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))}`;
|
|
3504
3550
|
const customConfig = {
|
|
3505
3551
|
...baseRequestConfig,
|
|
3506
3552
|
headers: {
|
|
3507
3553
|
...baseRequestConfig.headers,
|
|
3508
|
-
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && {
|
|
3554
|
+
...(!requestConfig?.headers || !("Referer" in requestConfig.headers)) && { referer: refererUrl }
|
|
3509
3555
|
}
|
|
3510
3556
|
};
|
|
3557
|
+
const isUserSearch = searchType === "用户";
|
|
3558
|
+
const isVideoSearch = searchType === "视频";
|
|
3559
|
+
let isFirstRequest = true;
|
|
3511
3560
|
while (fetchedSearchList.length < Number(data$1.number ?? 10)) {
|
|
3512
3561
|
const requestCount = Math.min(Number(data$1.number ?? 50) - fetchedSearchList.length, maxPageSize);
|
|
3513
3562
|
const url$1 = douyinApiUrls$1.搜索({
|
|
3514
3563
|
query: data$1.query,
|
|
3564
|
+
type: data$1.type,
|
|
3515
3565
|
number: requestCount,
|
|
3516
3566
|
search_id: search_id === "" ? void 0 : search_id
|
|
3517
3567
|
});
|
|
3518
3568
|
const raw = await GlobalGetData$2(data$1.methodType, {
|
|
3519
3569
|
...customConfig,
|
|
3520
|
-
url:
|
|
3570
|
+
url: url$1
|
|
3521
3571
|
});
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
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;
|
|
3541
3711
|
}
|
|
3542
|
-
|
|
3712
|
+
isFirstRequest = false;
|
|
3543
3713
|
}
|
|
3544
|
-
|
|
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
|
+
} : {
|
|
3545
3722
|
...tmpresp ?? {},
|
|
3546
|
-
data:
|
|
3723
|
+
data: slicedList
|
|
3547
3724
|
};
|
|
3548
3725
|
}
|
|
3549
3726
|
case "动态表情数据": {
|
|
@@ -4793,7 +4970,7 @@ let DynamicType = /* @__PURE__ */ function(DynamicType$1) {
|
|
|
4793
4970
|
|
|
4794
4971
|
//#endregion
|
|
4795
4972
|
//#region src/index.ts
|
|
4796
|
-
const VERSION = "5.
|
|
4973
|
+
const VERSION = "5.10.0";
|
|
4797
4974
|
/**
|
|
4798
4975
|
* @deprecated 请使用 createAmagiClient 替代
|
|
4799
4976
|
*/
|
|
@@ -4859,6 +5036,7 @@ exports.DouyinCommentReplyParamsSchema = DouyinCommentReplyParamsSchema;
|
|
|
4859
5036
|
exports.DouyinDanmakuParamsSchema = DouyinDanmakuParamsSchema;
|
|
4860
5037
|
exports.DouyinEmojiListParamsSchema = DouyinEmojiListParamsSchema;
|
|
4861
5038
|
exports.DouyinEmojiProParamsSchema = DouyinEmojiProParamsSchema;
|
|
5039
|
+
exports.DouyinHotWordsParamsSchema = DouyinHotWordsParamsSchema;
|
|
4862
5040
|
exports.DouyinLiveRoomParamsSchema = DouyinLiveRoomParamsSchema;
|
|
4863
5041
|
exports.DouyinMethodRoutes = DouyinMethodRoutes;
|
|
4864
5042
|
exports.DouyinMusicParamsSchema = DouyinMusicParamsSchema;
|