@lmcc-dev/mult-fetch-mcp-server 1.0.2 → 1.1.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/README.md +14 -2
- package/README.zh.md +3 -2
- package/dist/src/client.d.ts +6 -0
- package/dist/src/client.js +26 -28
- package/dist/src/client.js.map +1 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/BrowserFetcher.d.ts +175 -0
- package/dist/src/lib/BrowserFetcher.js +99 -65
- package/dist/src/lib/BrowserFetcher.js.map +1 -0
- package/dist/src/lib/NodeFetcher.d.ts +92 -0
- package/dist/src/lib/NodeFetcher.js +150 -86
- package/dist/src/lib/NodeFetcher.js.map +1 -0
- package/dist/src/lib/i18n/index.js.map +1 -0
- package/dist/src/lib/i18n/keys.js +135 -0
- package/dist/src/lib/i18n/locales/en/browser.d.ts +61 -0
- package/dist/src/lib/i18n/locales/en/browser.js +68 -45
- package/dist/src/lib/i18n/locales/en/browser.js.map +1 -0
- package/dist/src/lib/i18n/locales/en/client.d.ts +39 -0
- package/dist/src/lib/i18n/locales/en/client.js.map +1 -0
- package/dist/src/lib/i18n/locales/en/errors.d.ts +17 -0
- package/dist/src/lib/i18n/locales/en/errors.js.map +1 -0
- package/dist/src/lib/i18n/locales/en/fetcher.d.ts +66 -0
- package/dist/src/lib/i18n/locales/en/fetcher.js +60 -59
- package/dist/src/lib/i18n/locales/en/fetcher.js.map +1 -0
- package/dist/src/lib/i18n/locales/en/index.d.ts +344 -0
- package/dist/src/lib/i18n/locales/en/index.js +1 -1
- package/dist/src/lib/i18n/locales/en/index.js.map +1 -0
- package/dist/src/lib/i18n/locales/en/node.d.ts +41 -0
- package/dist/src/lib/i18n/locales/en/node.js.map +1 -0
- package/dist/src/lib/i18n/locales/en/prompts.d.ts +65 -0
- package/dist/src/lib/i18n/locales/en/prompts.js.map +1 -0
- package/dist/src/lib/i18n/locales/en/resources.d.ts +41 -0
- package/dist/src/lib/i18n/locales/en/resources.js +30 -15
- package/dist/src/lib/i18n/locales/en/resources.js.map +1 -0
- package/dist/src/lib/i18n/locales/en/server.d.ts +30 -0
- package/dist/src/lib/i18n/locales/en/server.js.map +1 -0
- package/dist/src/lib/i18n/locales/en/tools.d.ts +24 -0
- package/dist/src/lib/i18n/locales/en/tools.js.map +1 -0
- package/dist/src/lib/i18n/locales/zh/browser.d.ts +61 -0
- package/dist/src/lib/i18n/locales/zh/browser.js +68 -45
- package/dist/src/lib/i18n/locales/zh/browser.js.map +1 -0
- package/dist/src/lib/i18n/locales/zh/client.d.ts +38 -0
- package/dist/src/lib/i18n/locales/zh/client.js.map +1 -0
- package/dist/src/lib/i18n/locales/zh/errors.d.ts +17 -0
- package/dist/src/lib/i18n/locales/zh/errors.js.map +1 -0
- package/dist/src/lib/i18n/locales/zh/fetcher.d.ts +66 -0
- package/dist/src/lib/i18n/locales/zh/fetcher.js +60 -59
- package/dist/src/lib/i18n/locales/zh/fetcher.js.map +1 -0
- package/dist/src/lib/i18n/locales/zh/index.d.ts +343 -0
- package/dist/src/lib/i18n/locales/zh/index.js +1 -1
- package/dist/src/lib/i18n/locales/zh/index.js.map +1 -0
- package/dist/src/lib/i18n/locales/zh/node.d.ts +41 -0
- package/dist/src/lib/i18n/locales/zh/node.js.map +1 -0
- package/dist/src/lib/i18n/locales/zh/prompts.d.ts +65 -0
- package/dist/src/lib/i18n/locales/zh/prompts.js.map +1 -0
- package/dist/src/lib/i18n/locales/zh/resources.d.ts +41 -0
- package/dist/src/lib/i18n/locales/zh/resources.js +28 -13
- package/dist/src/lib/i18n/locales/zh/resources.js.map +1 -0
- package/dist/src/lib/i18n/locales/zh/server.d.ts +30 -0
- package/dist/src/lib/i18n/locales/zh/server.js.map +1 -0
- package/dist/src/lib/i18n/locales/zh/tools.d.ts +24 -0
- package/dist/src/lib/i18n/locales/zh/tools.js.map +1 -0
- package/dist/src/lib/i18n/logger.d.ts +38 -0
- package/dist/src/lib/i18n/logger.js.map +1 -0
- package/dist/src/lib/logger.d.ts +32 -0
- package/dist/src/lib/logger.js.map +1 -0
- package/dist/src/lib/server/browser.d.ts +34 -0
- package/dist/src/lib/server/browser.js +10 -16
- package/dist/src/lib/server/browser.js.map +1 -0
- package/dist/src/lib/server/fetcher.d.ts +20 -0
- package/dist/src/lib/server/fetcher.js.map +1 -0
- package/dist/src/lib/server/index.d.ts +10 -0
- package/dist/src/lib/server/index.js.map +1 -0
- package/dist/src/lib/server/prompts.d.ts +11 -0
- package/dist/src/lib/server/prompts.js +6 -6
- package/dist/src/lib/server/prompts.js.map +1 -0
- package/dist/src/lib/server/resources.d.ts +11 -0
- package/dist/src/lib/server/resources.js.map +1 -0
- package/dist/src/lib/server/tools.d.ts +12 -0
- package/dist/src/lib/server/tools.js +369 -309
- package/dist/src/lib/server/tools.js.map +1 -0
- package/dist/src/lib/server/types.d.ts +71 -0
- package/dist/src/lib/server/types.js.map +1 -0
- package/dist/src/lib/types.d.ts +119 -0
- package/dist/src/lib/types.js.map +1 -0
- package/dist/src/lib/utils/errorDetection.js +41 -0
- package/dist/src/lib/utils/errors.js +279 -0
- package/dist/src/mcp-server.d.ts +6 -0
- package/dist/src/mcp-server.js.map +1 -0
- package/dist/tests/BrowserFetcher.test.js +951 -0
- package/dist/tests/NodeFetcher.test.js +263 -0
- package/dist/tests/client.test.js +250 -0
- package/dist/tests/i18n.test.js +179 -0
- package/dist/tests/jest.setup.d.ts +6 -0
- package/dist/tests/jest.setup.js +30 -0
- package/dist/tests/jest.setup.js.map +1 -0
- package/dist/tests/logger.test.js +99 -0
- package/dist/tests/mcp-server.test.js +113 -0
- package/dist/tests/server/browser.test.js +197 -0
- package/dist/tests/server/fetcher.test.js +216 -0
- package/dist/tests/server/index.test.js +122 -0
- package/dist/tests/server/prompts.test.js +243 -0
- package/dist/tests/server/resources.test.js +359 -0
- package/dist/tests/server/tools.test.js +222 -0
- package/dist/tests/test-direct-client.d.ts +6 -0
- package/dist/tests/test-direct-client.js.map +1 -0
- package/dist/tests/test-mcp-methods.d.ts +6 -0
- package/dist/tests/test-mcp-methods.js.map +1 -0
- package/dist/tests/test-mcp.d.ts +6 -0
- package/dist/tests/test-mcp.js.map +1 -0
- package/dist/tests/test-mini4k.d.ts +6 -0
- package/dist/tests/test-mini4k.js.map +1 -0
- package/dist/tests/types.test.js +57 -0
- package/package.json +12 -3
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
import { RequestPayload } from "./types.js";
|
|
7
|
+
export declare class NodeFetcher {
|
|
8
|
+
/**
|
|
9
|
+
* 常用浏览器的User-Agent列表 (List of common browser User-Agents)
|
|
10
|
+
* 用于模拟不同浏览器的请求 (Used to simulate requests from different browsers)
|
|
11
|
+
*/
|
|
12
|
+
private static userAgents;
|
|
13
|
+
/**
|
|
14
|
+
* 获取随机User-Agent (Get random User-Agent)
|
|
15
|
+
* @returns 随机的User-Agent字符串 (Random User-Agent string)
|
|
16
|
+
*/
|
|
17
|
+
private static getRandomUserAgent;
|
|
18
|
+
/**
|
|
19
|
+
* 随机延迟函数 (Random delay function)
|
|
20
|
+
* 模拟人类行为,避免被检测为机器人 (Simulate human behavior, avoid being detected as a bot)
|
|
21
|
+
* @param minMs 最小延迟毫秒数 (Minimum delay in milliseconds)
|
|
22
|
+
* @param maxMs 最大延迟毫秒数 (Maximum delay in milliseconds)
|
|
23
|
+
* @returns Promise对象 (Promise object)
|
|
24
|
+
*/
|
|
25
|
+
private static randomDelay;
|
|
26
|
+
/**
|
|
27
|
+
* 获取系统代理设置 (Get system proxy settings)
|
|
28
|
+
* @param useSystemProxy 是否使用系统代理 (Whether to use system proxy)
|
|
29
|
+
* @returns 代理URL或undefined (Proxy URL or undefined)
|
|
30
|
+
*/
|
|
31
|
+
private static getSystemProxy;
|
|
32
|
+
/**
|
|
33
|
+
* 执行带重定向处理的HTTP请求 (Perform HTTP request with redirect handling)
|
|
34
|
+
* @param requestPayload 请求参数 (Request parameters)
|
|
35
|
+
* @returns 响应数据 (Response data)
|
|
36
|
+
*/
|
|
37
|
+
private static _fetchWithRedirects;
|
|
38
|
+
/**
|
|
39
|
+
* 获取HTML内容 (Get HTML content)
|
|
40
|
+
* @param requestPayload 请求参数 (Request parameters)
|
|
41
|
+
* @returns HTML内容 (HTML content)
|
|
42
|
+
*/
|
|
43
|
+
static html(requestPayload: RequestPayload): Promise<{
|
|
44
|
+
html: any;
|
|
45
|
+
url: any;
|
|
46
|
+
status: any;
|
|
47
|
+
headers: {
|
|
48
|
+
[k: string]: any;
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* 获取JSON内容 (Get JSON content)
|
|
53
|
+
* @param requestPayload 请求参数 (Request parameters)
|
|
54
|
+
* @returns JSON内容 (JSON content)
|
|
55
|
+
*/
|
|
56
|
+
static json(requestPayload: RequestPayload): Promise<{
|
|
57
|
+
json: any;
|
|
58
|
+
text: any;
|
|
59
|
+
url: any;
|
|
60
|
+
status: any;
|
|
61
|
+
headers: {
|
|
62
|
+
[k: string]: any;
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* 获取纯文本内容 (Get plain text content)
|
|
67
|
+
* @param requestPayload 请求参数 (Request parameters)
|
|
68
|
+
* @returns 纯文本内容 (Plain text content)
|
|
69
|
+
*/
|
|
70
|
+
static txt(requestPayload: RequestPayload): Promise<{
|
|
71
|
+
text: any;
|
|
72
|
+
url: any;
|
|
73
|
+
status: any;
|
|
74
|
+
headers: {
|
|
75
|
+
[k: string]: any;
|
|
76
|
+
};
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* 获取Markdown内容 (Get Markdown content)
|
|
80
|
+
* @param requestPayload 请求参数 (Request parameters)
|
|
81
|
+
* @returns Markdown内容 (Markdown content)
|
|
82
|
+
*/
|
|
83
|
+
static markdown(requestPayload: RequestPayload): Promise<{
|
|
84
|
+
markdown: string;
|
|
85
|
+
html: any;
|
|
86
|
+
url: any;
|
|
87
|
+
status: any;
|
|
88
|
+
headers: {
|
|
89
|
+
[k: string]: any;
|
|
90
|
+
};
|
|
91
|
+
}>;
|
|
92
|
+
}
|
|
@@ -124,9 +124,139 @@ export class NodeFetcher {
|
|
|
124
124
|
return undefined;
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
128
|
-
* @param
|
|
129
|
-
* @
|
|
127
|
+
* 处理请求延迟 (Handle request delay)
|
|
128
|
+
* @param noDelay 是否禁用延迟 (Whether to disable delay)
|
|
129
|
+
* @param isRedirect 是否是重定向请求 (Whether it's a redirect request)
|
|
130
|
+
* @param debug 是否启用调试模式 (Whether debug mode is enabled)
|
|
131
|
+
*/
|
|
132
|
+
static async handleDelay(noDelay, isRedirect, debug) {
|
|
133
|
+
if (!noDelay && isRedirect) {
|
|
134
|
+
await this.randomDelay();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 准备请求头 (Prepare request headers)
|
|
139
|
+
* @param headers 原始请求头 (Original headers)
|
|
140
|
+
* @param debug 是否启用调试模式 (Whether debug mode is enabled)
|
|
141
|
+
* @returns 处理后的请求头 (Processed headers)
|
|
142
|
+
*/
|
|
143
|
+
static prepareHeaders(headers = {}, debug) {
|
|
144
|
+
const requestHeaders = { ...headers };
|
|
145
|
+
// 添加随机User-Agent (Add random User-Agent)
|
|
146
|
+
if (!requestHeaders['User-Agent']) {
|
|
147
|
+
const userAgent = this.getRandomUserAgent();
|
|
148
|
+
requestHeaders['User-Agent'] = userAgent;
|
|
149
|
+
log('node.usingUserAgent', debug, { userAgent }, COMPONENTS.NODE_FETCH);
|
|
150
|
+
}
|
|
151
|
+
return requestHeaders;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* 设置代理 (Set proxy)
|
|
155
|
+
* @param url 请求URL (Request URL)
|
|
156
|
+
* @param proxy 代理URL (Proxy URL)
|
|
157
|
+
* @param debug 是否启用调试模式 (Whether debug mode is enabled)
|
|
158
|
+
* @returns 代理Agent (Proxy agent)
|
|
159
|
+
*/
|
|
160
|
+
static setupProxy(url, proxy, debug) {
|
|
161
|
+
if (!proxy)
|
|
162
|
+
return undefined;
|
|
163
|
+
let agent = undefined;
|
|
164
|
+
if (url.startsWith('https://')) {
|
|
165
|
+
agent = new HttpsProxyAgent(proxy);
|
|
166
|
+
log('node.usingHttpsProxy', debug, {}, COMPONENTS.NODE_FETCH);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
agent = new HttpProxyAgent(proxy);
|
|
170
|
+
log('node.usingHttpProxy', debug, {}, COMPONENTS.NODE_FETCH);
|
|
171
|
+
}
|
|
172
|
+
return agent;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* 处理重定向URL (Handle redirect URL)
|
|
176
|
+
* @param location 重定向位置 (Redirect location)
|
|
177
|
+
* @param currentUrl 当前URL (Current URL)
|
|
178
|
+
* @param debug 是否启用调试模式 (Whether debug mode is enabled)
|
|
179
|
+
* @returns 完整的重定向URL (Complete redirect URL)
|
|
180
|
+
*/
|
|
181
|
+
static buildRedirectUrl(location, currentUrl, debug) {
|
|
182
|
+
let redirectUrl = location;
|
|
183
|
+
if (location.startsWith('/')) {
|
|
184
|
+
const urlObj = new URL(currentUrl);
|
|
185
|
+
redirectUrl = `${urlObj.protocol}//${urlObj.host}${location}`;
|
|
186
|
+
}
|
|
187
|
+
else if (!location.startsWith('http')) {
|
|
188
|
+
redirectUrl = new URL(location, currentUrl).toString();
|
|
189
|
+
}
|
|
190
|
+
log('node.constructedFullRedirectUrl', debug, { redirectUrl }, COMPONENTS.NODE_FETCH);
|
|
191
|
+
return redirectUrl;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* 处理错误响应 (Handle error response)
|
|
195
|
+
* @param response 响应对象 (Response object)
|
|
196
|
+
* @param debug 是否启用调试模式 (Whether debug mode is enabled)
|
|
197
|
+
* @returns Promise<never> 抛出错误 (Throws error)
|
|
198
|
+
*/
|
|
199
|
+
static async handleErrorResponse(response, debug) {
|
|
200
|
+
log('node.errorResponse', debug, { status: response.status, statusText: response.statusText }, COMPONENTS.NODE_FETCH);
|
|
201
|
+
// 尝试读取错误响应体 (Try to read error response body)
|
|
202
|
+
let errorText = '';
|
|
203
|
+
try {
|
|
204
|
+
errorText = await response.text();
|
|
205
|
+
log('node.errorResponseBody', debug, { body: errorText.substring(0, 200) + (errorText.length > 200 ? '...' : '') }, COMPONENTS.NODE_FETCH);
|
|
206
|
+
}
|
|
207
|
+
catch (textError) {
|
|
208
|
+
log('node.errorReadingBody', debug, { error: String(textError) }, COMPONENTS.NODE_FETCH);
|
|
209
|
+
}
|
|
210
|
+
// 创建错误对象 (Create error object)
|
|
211
|
+
const error = new Error(`HTTP Error ${response.status}: ${response.statusText}`);
|
|
212
|
+
error.status = response.status;
|
|
213
|
+
error.statusText = response.statusText;
|
|
214
|
+
error.body = errorText;
|
|
215
|
+
throw error;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* 处理请求错误 (Handle request error)
|
|
219
|
+
* @param error 错误对象 (Error object)
|
|
220
|
+
* @param fetchStart 请求开始时间 (Request start time)
|
|
221
|
+
* @param timeout 超时时间 (Timeout)
|
|
222
|
+
* @param redirectCount 重定向计数 (Redirect count)
|
|
223
|
+
* @param maxRedirects 最大重定向次数 (Maximum redirects)
|
|
224
|
+
* @param debug 是否启用调试模式 (Whether debug mode is enabled)
|
|
225
|
+
* @returns Promise<never> 抛出错误 (Throws error)
|
|
226
|
+
*/
|
|
227
|
+
static handleRequestError(error, fetchStart, timeout, redirectCount, maxRedirects, debug) {
|
|
228
|
+
// 记录错误 (Log error)
|
|
229
|
+
log('node.fetchError', debug, { error: String(error) }, COMPONENTS.NODE_FETCH);
|
|
230
|
+
// 处理超时错误 (Handle timeout error)
|
|
231
|
+
if (error.name === 'AbortError') {
|
|
232
|
+
log('node.requestAborted', debug, { duration: Date.now() - fetchStart }, COMPONENTS.NODE_FETCH);
|
|
233
|
+
const timeoutError = new Error(`Request timeout after ${timeout}ms`);
|
|
234
|
+
timeoutError.code = 'ETIMEDOUT';
|
|
235
|
+
timeoutError.timeout = timeout;
|
|
236
|
+
throw timeoutError;
|
|
237
|
+
}
|
|
238
|
+
// 处理网络错误 (Handle network error)
|
|
239
|
+
if (error.code) {
|
|
240
|
+
log('node.networkError', debug, { code: error.code || error.name }, COMPONENTS.NODE_FETCH);
|
|
241
|
+
const networkError = new Error(`Network error: ${error.code || error.message}`);
|
|
242
|
+
networkError.code = error.code;
|
|
243
|
+
networkError.originalError = error;
|
|
244
|
+
throw networkError;
|
|
245
|
+
}
|
|
246
|
+
// 处理重定向错误 (Handle redirect error)
|
|
247
|
+
if (redirectCount >= maxRedirects) {
|
|
248
|
+
log('node.tooManyRedirects', debug, { redirects: maxRedirects }, COMPONENTS.NODE_FETCH);
|
|
249
|
+
const redirectError = new Error(`Too many redirects (${maxRedirects})`);
|
|
250
|
+
redirectError.code = 'EMAXREDIRECTS';
|
|
251
|
+
redirectError.redirects = redirectCount;
|
|
252
|
+
throw redirectError;
|
|
253
|
+
}
|
|
254
|
+
// 重新抛出其他错误 (Rethrow other errors)
|
|
255
|
+
throw error;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* 执行带重定向处理的HTTP请求 (Execute HTTP request with redirect handling)
|
|
259
|
+
* 支持自动处理重定向、超时和代理 (Supports automatic handling of redirects, timeouts, and proxies)
|
|
130
260
|
*/
|
|
131
261
|
static async _fetchWithRedirects({ url, headers = {}, proxy, noDelay, timeout = 30000, // 默认30秒超时
|
|
132
262
|
maxRedirects = 10, // 最大重定向次数
|
|
@@ -152,20 +282,12 @@ export class NodeFetcher {
|
|
|
152
282
|
// 处理重定向循环 (Handle redirect loop)
|
|
153
283
|
while (redirectCount < maxRedirects) {
|
|
154
284
|
log('node.fetchingUrl', debug, { url: currentUrl, redirect: redirectCount }, COMPONENTS.NODE_FETCH);
|
|
155
|
-
//
|
|
156
|
-
|
|
157
|
-
await this.randomDelay();
|
|
158
|
-
}
|
|
285
|
+
// 处理延迟 (Handle delay)
|
|
286
|
+
await this.handleDelay(noDelay, redirectCount > 0, debug);
|
|
159
287
|
// 准备请求头 (Prepare request headers)
|
|
160
|
-
const requestHeaders =
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// 添加随机User-Agent (Add random User-Agent)
|
|
164
|
-
if (!requestHeaders['User-Agent']) {
|
|
165
|
-
const userAgent = this.getRandomUserAgent();
|
|
166
|
-
requestHeaders['User-Agent'] = userAgent;
|
|
167
|
-
log('node.usingUserAgent', debug, { userAgent }, COMPONENTS.NODE_FETCH);
|
|
168
|
-
}
|
|
288
|
+
const requestHeaders = this.prepareHeaders(headers, debug);
|
|
289
|
+
// 设置代理 (Set proxy)
|
|
290
|
+
const agent = this.setupProxy(currentUrl, finalProxy, debug);
|
|
169
291
|
// 准备请求选项 (Prepare request options)
|
|
170
292
|
const fetchOptions = {
|
|
171
293
|
method: 'GET',
|
|
@@ -173,17 +295,7 @@ export class NodeFetcher {
|
|
|
173
295
|
timeout,
|
|
174
296
|
signal: controller.signal,
|
|
175
297
|
};
|
|
176
|
-
|
|
177
|
-
let agent = undefined;
|
|
178
|
-
if (finalProxy) {
|
|
179
|
-
if (currentUrl.startsWith('https://')) {
|
|
180
|
-
agent = new HttpsProxyAgent(finalProxy);
|
|
181
|
-
log('node.usingHttpsProxy', debug, {}, COMPONENTS.NODE_FETCH);
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
agent = new HttpProxyAgent(finalProxy);
|
|
185
|
-
log('node.usingHttpProxy', debug, {}, COMPONENTS.NODE_FETCH);
|
|
186
|
-
}
|
|
298
|
+
if (agent) {
|
|
187
299
|
fetchOptions.agent = agent;
|
|
188
300
|
}
|
|
189
301
|
// 记录请求详情 (Log request details)
|
|
@@ -209,17 +321,7 @@ export class NodeFetcher {
|
|
|
209
321
|
const location = response.headers.get('location');
|
|
210
322
|
log('node.redirectingTo', debug, { location }, COMPONENTS.NODE_FETCH);
|
|
211
323
|
// 构建完整的重定向URL (Build complete redirect URL)
|
|
212
|
-
|
|
213
|
-
if (location.startsWith('/')) {
|
|
214
|
-
const urlObj = new URL(currentUrl);
|
|
215
|
-
redirectUrl = `${urlObj.protocol}//${urlObj.host}${location}`;
|
|
216
|
-
}
|
|
217
|
-
else if (!location.startsWith('http')) {
|
|
218
|
-
redirectUrl = new URL(location, currentUrl).toString();
|
|
219
|
-
}
|
|
220
|
-
log('node.constructedFullRedirectUrl', debug, { redirectUrl }, COMPONENTS.NODE_FETCH);
|
|
221
|
-
// 更新当前URL为重定向URL (Update current URL to redirect URL)
|
|
222
|
-
currentUrl = redirectUrl;
|
|
324
|
+
currentUrl = this.buildRedirectUrl(location, currentUrl, debug);
|
|
223
325
|
continue;
|
|
224
326
|
}
|
|
225
327
|
// 如果响应成功,返回响应 (If response is successful, return response)
|
|
@@ -229,58 +331,15 @@ export class NodeFetcher {
|
|
|
229
331
|
}
|
|
230
332
|
else {
|
|
231
333
|
// 处理错误响应 (Handle error response)
|
|
232
|
-
|
|
233
|
-
// 尝试读取错误响应体 (Try to read error response body)
|
|
234
|
-
let errorText = '';
|
|
235
|
-
try {
|
|
236
|
-
errorText = await response.text();
|
|
237
|
-
log('node.errorResponseBody', debug, { body: errorText.substring(0, 200) + (errorText.length > 200 ? '...' : '') }, COMPONENTS.NODE_FETCH);
|
|
238
|
-
}
|
|
239
|
-
catch (textError) {
|
|
240
|
-
log('node.errorReadingBody', debug, { error: String(textError) }, COMPONENTS.NODE_FETCH);
|
|
241
|
-
}
|
|
242
|
-
// 创建错误对象 (Create error object)
|
|
243
|
-
const error = new Error(`HTTP Error ${response.status}: ${response.statusText}`);
|
|
244
|
-
error.status = response.status;
|
|
245
|
-
error.statusText = response.statusText;
|
|
246
|
-
error.body = errorText;
|
|
247
|
-
throw error;
|
|
334
|
+
return await this.handleErrorResponse(response, debug);
|
|
248
335
|
}
|
|
249
336
|
}
|
|
250
337
|
// 如果达到最大重定向次数,抛出错误 (If maximum redirects reached, throw error)
|
|
251
338
|
throw new Error(`Too many redirects (${maxRedirects})`);
|
|
252
339
|
}
|
|
253
340
|
catch (error) {
|
|
254
|
-
//
|
|
255
|
-
|
|
256
|
-
// 记录错误 (Log error)
|
|
257
|
-
log('node.fetchError', debug, { error: String(error) }, COMPONENTS.NODE_FETCH);
|
|
258
|
-
// 处理超时错误 (Handle timeout error)
|
|
259
|
-
if (error.name === 'AbortError') {
|
|
260
|
-
log('node.requestAborted', debug, { duration: Date.now() - fetchStart }, COMPONENTS.NODE_FETCH);
|
|
261
|
-
const timeoutError = new Error(`Request timeout after ${timeout}ms`);
|
|
262
|
-
timeoutError.code = 'ETIMEDOUT';
|
|
263
|
-
timeoutError.timeout = timeout;
|
|
264
|
-
throw timeoutError;
|
|
265
|
-
}
|
|
266
|
-
// 处理网络错误 (Handle network error)
|
|
267
|
-
if (error.code) {
|
|
268
|
-
log('node.networkError', debug, { code: error.code || error.name }, COMPONENTS.NODE_FETCH);
|
|
269
|
-
const networkError = new Error(`Network error: ${error.code || error.message}`);
|
|
270
|
-
networkError.code = error.code;
|
|
271
|
-
networkError.originalError = error;
|
|
272
|
-
throw networkError;
|
|
273
|
-
}
|
|
274
|
-
// 处理重定向错误 (Handle redirect error)
|
|
275
|
-
if (redirectCount >= maxRedirects) {
|
|
276
|
-
log('node.tooManyRedirects', debug, { redirects: maxRedirects }, COMPONENTS.NODE_FETCH);
|
|
277
|
-
const redirectError = new Error(`Too many redirects (${maxRedirects})`);
|
|
278
|
-
redirectError.code = 'EMAXREDIRECTS';
|
|
279
|
-
redirectError.redirects = redirectCount;
|
|
280
|
-
throw redirectError;
|
|
281
|
-
}
|
|
282
|
-
// 重新抛出其他错误 (Rethrow other errors)
|
|
283
|
-
throw error;
|
|
341
|
+
// 处理请求错误 (Handle request error)
|
|
342
|
+
this.handleRequestError(error, fetchStart, timeout, redirectCount, maxRedirects, debug);
|
|
284
343
|
}
|
|
285
344
|
finally {
|
|
286
345
|
// 清除超时定时器 (Clear timeout timer)
|
|
@@ -339,10 +398,15 @@ export class NodeFetcher {
|
|
|
339
398
|
}
|
|
340
399
|
catch (parseError) {
|
|
341
400
|
// 处理JSON解析错误 (Handle JSON parse error)
|
|
342
|
-
const
|
|
401
|
+
const textPreview = text.length > 100 ? `${text.substring(0, 100)}...` : text;
|
|
402
|
+
const error = new Error(`Invalid JSON: ${parseError instanceof Error ? parseError.message : String(parseError)}. Text preview: "${textPreview}", length: ${text.length}`);
|
|
343
403
|
error.text = text;
|
|
344
404
|
error.originalError = parseError;
|
|
345
|
-
log('
|
|
405
|
+
log('fetcher.jsonParseError', debug, {
|
|
406
|
+
error: String(parseError),
|
|
407
|
+
textPreview,
|
|
408
|
+
textLength: text.length
|
|
409
|
+
}, COMPONENTS.NODE_FETCH);
|
|
346
410
|
throw error;
|
|
347
411
|
}
|
|
348
412
|
// 返回JSON内容 (Return JSON content)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeFetcher.js","sourceRoot":"","sources":["../../../src/lib/NodeFetcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,eAAe,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,OAAO,WAAW;IACtB;;;OAGG;IACK,MAAM,CAAC,UAAU,GAAG;QAC1B,SAAS;QACT,qHAAqH;QACrH,2HAA2H;QAC3H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W,EAAE,OAAa,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAEzE,gDAAgD;AAChD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AAEhF,oDAAoD;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 共享的国际化键结构 (Shared internationalization key structure)
|
|
8
|
+
* 用于避免在不同语言文件中重复相同的键结构 (Used to avoid repeating the same key structure in different language files)
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* 获取器相关键 (Fetcher related keys)
|
|
12
|
+
*/
|
|
13
|
+
export const FETCHER_KEYS = {
|
|
14
|
+
addingDelay: 'fetcher.addingDelay',
|
|
15
|
+
delayCompleted: 'fetcher.delayCompleted',
|
|
16
|
+
usingProxy: 'fetcher.usingProxy',
|
|
17
|
+
usingSpecifiedProxy: 'fetcher.usingSpecifiedProxy',
|
|
18
|
+
attemptingToUseSystemProxy: 'fetcher.attemptingToUseSystemProxy',
|
|
19
|
+
notUsingProxy: 'fetcher.notUsingProxy',
|
|
20
|
+
finalProxyUsed: 'fetcher.finalProxyUsed',
|
|
21
|
+
noProxy: 'fetcher.noProxy',
|
|
22
|
+
fetchingUrl: 'fetcher.fetchingUrl',
|
|
23
|
+
usingUserAgent: 'fetcher.usingUserAgent',
|
|
24
|
+
usingHttpsProxy: 'fetcher.usingHttpsProxy',
|
|
25
|
+
usingHttpProxy: 'fetcher.usingHttpProxy',
|
|
26
|
+
requestOptions: 'fetcher.requestOptions',
|
|
27
|
+
startingFetch: 'fetcher.startingFetch',
|
|
28
|
+
fetchCompleted: 'fetcher.fetchCompleted',
|
|
29
|
+
responseStatus: 'fetcher.responseStatus',
|
|
30
|
+
redirectingTo: 'fetcher.redirectingTo',
|
|
31
|
+
constructedFullRedirectUrl: 'fetcher.constructedFullRedirectUrl',
|
|
32
|
+
requestSuccess: 'fetcher.requestSuccess',
|
|
33
|
+
errorResponse: 'fetcher.errorResponse',
|
|
34
|
+
errorResponseBody: 'fetcher.errorResponseBody',
|
|
35
|
+
errorReadingBody: 'fetcher.errorReadingBody',
|
|
36
|
+
fetchError: 'fetcher.fetchError',
|
|
37
|
+
requestAborted: 'fetcher.requestAborted',
|
|
38
|
+
networkError: 'fetcher.networkError',
|
|
39
|
+
requestTimeout: 'fetcher.requestTimeout',
|
|
40
|
+
fetchFailed: 'fetcher.fetchFailed',
|
|
41
|
+
tooManyRedirects: 'fetcher.tooManyRedirects',
|
|
42
|
+
startingHtmlFetch: 'fetcher.startingHtmlFetch',
|
|
43
|
+
readingText: 'fetcher.readingText',
|
|
44
|
+
htmlContentLength: 'fetcher.htmlContentLength',
|
|
45
|
+
startingJsonFetch: 'fetcher.startingJsonFetch',
|
|
46
|
+
parsingJson: 'fetcher.parsingJson',
|
|
47
|
+
jsonParsed: 'fetcher.jsonParsed',
|
|
48
|
+
jsonParseError: 'fetcher.jsonParseError',
|
|
49
|
+
startingTxtFetch: 'fetcher.startingTxtFetch',
|
|
50
|
+
textContentLength: 'fetcher.textContentLength',
|
|
51
|
+
startingMarkdownFetch: 'fetcher.startingMarkdownFetch',
|
|
52
|
+
creatingTurndown: 'fetcher.creatingTurndown',
|
|
53
|
+
convertingToMarkdown: 'fetcher.convertingToMarkdown',
|
|
54
|
+
markdownContentLength: 'fetcher.markdownContentLength',
|
|
55
|
+
checkingProxyEnv: 'fetcher.checkingProxyEnv',
|
|
56
|
+
envVarValue: 'fetcher.envVarValue',
|
|
57
|
+
foundSystemProxy: 'fetcher.foundSystemProxy',
|
|
58
|
+
systemCommandProxySettings: 'fetcher.systemCommandProxySettings',
|
|
59
|
+
foundProxyFromCommand: 'fetcher.foundProxyFromCommand',
|
|
60
|
+
errorGettingProxyFromCommand: 'fetcher.errorGettingProxyFromCommand',
|
|
61
|
+
checkingSystemEnvVars: 'fetcher.checkingSystemEnvVars',
|
|
62
|
+
windowsEnvVars: 'fetcher.windowsEnvVars',
|
|
63
|
+
foundWindowsEnvProxy: 'fetcher.foundWindowsEnvProxy',
|
|
64
|
+
errorGettingWindowsEnvVars: 'fetcher.errorGettingWindowsEnvVars',
|
|
65
|
+
unixEnvVars: 'fetcher.unixEnvVars',
|
|
66
|
+
foundUnixEnvProxy: 'fetcher.foundUnixEnvProxy',
|
|
67
|
+
errorGettingUnixEnvVars: 'fetcher.errorGettingUnixEnvVars',
|
|
68
|
+
errorGettingSystemEnvVars: 'fetcher.errorGettingSystemEnvVars',
|
|
69
|
+
noSystemProxyFound: 'fetcher.noSystemProxyFound',
|
|
70
|
+
notSet: 'fetcher.notSet',
|
|
71
|
+
debug: 'fetcher.debug',
|
|
72
|
+
none: 'fetcher.none'
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* 浏览器相关键 (Browser related keys)
|
|
76
|
+
*/
|
|
77
|
+
export const BROWSER_KEYS = {
|
|
78
|
+
closing: 'browser.closing',
|
|
79
|
+
closed: 'browser.closed',
|
|
80
|
+
starting: 'browser.starting',
|
|
81
|
+
startingFailed: 'browser.startingFailed',
|
|
82
|
+
alreadyRunning: 'browser.alreadyRunning',
|
|
83
|
+
creatingPage: 'browser.creatingPage',
|
|
84
|
+
navigatingTo: 'browser.navigatingTo',
|
|
85
|
+
waitingForSelector: 'browser.waitingForSelector',
|
|
86
|
+
waitingForTimeout: 'browser.waitingForTimeout',
|
|
87
|
+
scrollingToBottom: 'browser.scrollingToBottom',
|
|
88
|
+
gettingContent: 'browser.gettingContent',
|
|
89
|
+
contentLength: 'browser.contentLength',
|
|
90
|
+
savingCookies: 'browser.savingCookies',
|
|
91
|
+
cookiesSaved: 'browser.cookiesSaved',
|
|
92
|
+
loadingCookies: 'browser.loadingCookies',
|
|
93
|
+
cookiesLoaded: 'browser.cookiesLoaded',
|
|
94
|
+
noCookiesFound: 'browser.noCookiesFound',
|
|
95
|
+
errorLoadingCookies: 'browser.errorLoadingCookies',
|
|
96
|
+
errorSavingCookies: 'browser.errorSavingCookies',
|
|
97
|
+
errorNavigating: 'browser.errorNavigating',
|
|
98
|
+
errorGettingContent: 'browser.errorGettingContent',
|
|
99
|
+
errorClosingBrowser: 'browser.errorClosingBrowser',
|
|
100
|
+
errorCreatingPage: 'browser.errorCreatingPage'
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* 资源相关键 (Resources related keys)
|
|
104
|
+
*/
|
|
105
|
+
export const RESOURCES_KEYS = {
|
|
106
|
+
list: {
|
|
107
|
+
request: 'resources.list.request',
|
|
108
|
+
success: 'resources.list.success',
|
|
109
|
+
error: 'resources.list.error'
|
|
110
|
+
},
|
|
111
|
+
get: {
|
|
112
|
+
request: 'resources.get.request',
|
|
113
|
+
success: 'resources.get.success',
|
|
114
|
+
error: 'resources.get.error',
|
|
115
|
+
notFound: 'resources.get.notFound'
|
|
116
|
+
},
|
|
117
|
+
create: {
|
|
118
|
+
request: 'resources.create.request',
|
|
119
|
+
success: 'resources.create.success',
|
|
120
|
+
error: 'resources.create.error',
|
|
121
|
+
duplicate: 'resources.create.duplicate'
|
|
122
|
+
},
|
|
123
|
+
update: {
|
|
124
|
+
request: 'resources.update.request',
|
|
125
|
+
success: 'resources.update.success',
|
|
126
|
+
error: 'resources.update.error',
|
|
127
|
+
notFound: 'resources.update.notFound'
|
|
128
|
+
},
|
|
129
|
+
delete: {
|
|
130
|
+
request: 'resources.delete.request',
|
|
131
|
+
success: 'resources.delete.success',
|
|
132
|
+
error: 'resources.delete.error',
|
|
133
|
+
notFound: 'resources.delete.notFound'
|
|
134
|
+
}
|
|
135
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
+
* Co-Author: AI Assistant (Claude)
|
|
4
|
+
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
+
*/
|
|
6
|
+
export declare const browser: {
|
|
7
|
+
closing: string;
|
|
8
|
+
closed: string;
|
|
9
|
+
starting: string;
|
|
10
|
+
startingFailed: string;
|
|
11
|
+
waiting: string;
|
|
12
|
+
startupSuccess: string;
|
|
13
|
+
navigating: string;
|
|
14
|
+
waitingForSelector: string;
|
|
15
|
+
waitingForTimeout: string;
|
|
16
|
+
scrolling: string;
|
|
17
|
+
scrollCompleted: string;
|
|
18
|
+
gettingContent: string;
|
|
19
|
+
savingCookies: string;
|
|
20
|
+
contentLength: string;
|
|
21
|
+
contentTruncated: string;
|
|
22
|
+
pageClosed: string;
|
|
23
|
+
fetchError: string;
|
|
24
|
+
highMemory: string;
|
|
25
|
+
closingDueToMemory: string;
|
|
26
|
+
closingError: string;
|
|
27
|
+
forcingGC: string;
|
|
28
|
+
memoryCheckError: string;
|
|
29
|
+
usingCookies: string;
|
|
30
|
+
usingProxy: string;
|
|
31
|
+
checkingCloudflare: string;
|
|
32
|
+
cloudflareDetected: string;
|
|
33
|
+
simulatingHuman: string;
|
|
34
|
+
simulatingHumanError: string;
|
|
35
|
+
stillOnCloudflare: string;
|
|
36
|
+
bypassFailed: string;
|
|
37
|
+
cloudflareError: string;
|
|
38
|
+
continuingWithoutBypass: string;
|
|
39
|
+
fetchingWithRetry: string;
|
|
40
|
+
memoryUsage: string;
|
|
41
|
+
memoryTooHigh: string;
|
|
42
|
+
unableToBypassCloudflare: string;
|
|
43
|
+
contentTooLarge: string;
|
|
44
|
+
failedToParseJSON: string;
|
|
45
|
+
startingBrowserFetchForMarkdown: string;
|
|
46
|
+
errorInBrowserFetchForMarkdown: string;
|
|
47
|
+
fetchRequest: string;
|
|
48
|
+
usingStoredCookies: string;
|
|
49
|
+
closingInstance: string;
|
|
50
|
+
fetchErrorWithAttempt: string;
|
|
51
|
+
retryingAfterDelay: string;
|
|
52
|
+
browserStartupSuccess: string;
|
|
53
|
+
browserStartupFailed: string;
|
|
54
|
+
usingCustomChromePath: string;
|
|
55
|
+
browserDisconnected: string;
|
|
56
|
+
waitingForBrowserStart: string;
|
|
57
|
+
reusingExistingBrowser: string;
|
|
58
|
+
startingBrowser: string;
|
|
59
|
+
browserStarted: string;
|
|
60
|
+
browserStartError: string;
|
|
61
|
+
};
|