@@ -45,8 +45,8 @@ Create a crawler instance via new XCrawl.
45
45
class XCrawl {
46
46
private readonly baseConfig
47
47
constructor (baseConfig ?: IXCrawlBaseConifg )
48
- fetchData<T = any>(config: IFetchDataConfig): Promise<IFetchData <T>>
49
- fetchFile(config: IFetchFileConfig): Promise<IFetchFile >
48
+ fetchData<T = any>(config: IFetchDataConfig): Promise<IFetchCommon <T>>
49
+ fetchFile(config: IFetchFileConfig): Promise<IFetchCommon<IFileInfo> >
50
50
fetchHTML(url: string): Promise<JSDOM>
51
51
}
52
52
` ` `
@@ -74,7 +74,7 @@ fetchData is the method of the above <a href="#myXCrawl" style="text-decoration:
74
74
- Type
75
75
76
76
` ` ` ts
77
- function fetchData <T = any>(config : IFetchDataConfig ): Promise<T >
77
+ function fetchData<T = any>(config : IFetchDataConfig ): Promise<IFetchCommon<T> >
78
78
```
79
79
80
80
- Example
@@ -101,7 +101,7 @@ fetchFile is the method of the above <a href="#myXCrawl" style="text-decoration
101
101
- Type
102
102
103
103
` ` ` ts
104
- function fetchFile (config : IFetchFileConfig ): Promise<IFetchFile >
104
+ function fetchFile (config : IFetchFileConfig ): Promise<IFetchCommon<IFileInfo> >
105
105
```
106
106
107
107
- Example
@@ -153,14 +153,14 @@ interface IAnyObject extends Object {
153
153
154
154
- IMethod
155
155
156
- ` ` ` ts
157
- export type IMethod = ' get' | ' GET' | ' delete' | ' DELETE' | ' head' | ' HEAD' | ' options' | ' OPTIONS' | ' post' | ' POST' | ' put' | ' PUT' | ' patch' | ' PATCH' | ' purge' | ' PURGE' | ' link' | ' LINK' | ' unlink' | ' UNLINK'
156
+ ` ` ` ts
157
+ type IMethod = ' get' | ' GET' | ' delete' | ' DELETE' | ' head' | ' HEAD' | ' options' | ' OPTIONS' | ' post' | ' POST' | ' put' | ' PUT' | ' patch' | ' PATCH' | ' purge' | ' PURGE' | ' link' | ' LINK' | ' unlink' | ' UNLINK'
158
158
` ` `
159
159
160
160
- IRequestConfig
161
161
162
162
` ` ` ts
163
- export interface IRequestConfig {
163
+ interface IRequestConfig {
164
164
url: string
165
165
method?: IMethod
166
166
headers?: IAnyObject
@@ -188,25 +188,26 @@ interface IFetchBaseConifg {
188
188
}
189
189
` ` `
190
190
191
- - IFechData
191
+ - IFetchCommon
192
192
193
193
` ` ` ts
194
- type IFetchData< T > = {
194
+ type IFetchCommon< T > = {
195
+ id: number
195
196
statusCode: number | undefined
196
- headers: IncomingHttpHeaders // node:http
197
+ headers: IncomingHttpHeaders // node:http type
197
198
data: T
198
199
}[]
199
200
` ` `
200
201
201
- - IFetchFile
202
+ - IFileInfo
202
203
203
204
` ` ` ts
204
- type IFetchFile = {
205
+ IFileInfo {
205
206
fileName: string
206
207
mimeType: string
207
208
size: number
208
209
filePath: string
209
- }[]
210
+ }
210
211
` ` `
211
212
212
213
- IXCrawlBaseConifg
@@ -238,7 +239,7 @@ interface IFetchFileConfig extends IFetchBaseConifg {
238
239
239
240
## More
240
241
241
- If you have any **questions** or **needs** , please submit **Issues in** https://github.com/coder-hxl/x-crawl .
242
+ If you have any **questions** or **needs** , please submit **Issues in** https://github.com/coder-hxl/x-crawl/issues .
242
243
243
244
244
245
---
@@ -291,8 +292,8 @@ docsXCrawl.fetchHTML('/zh/get-started').then((jsdom) => {
291
292
class XCrawl {
292
293
private readonly baseConfig
293
294
constructor(baseConfig?: IXCrawlBaseConifg)
294
- fetchData<T = any>(config: IFetchDataConfig): Promise<IFetchData <T>>
295
- fetchFile(config: IFetchFileConfig): Promise<IFetchFile >
295
+ fetchData<T = any>(config: IFetchDataConfig): Promise<IFetchCommon <T>>
296
+ fetchFile(config: IFetchFileConfig): Promise<IFetchCommon<IFileInfo> >
296
297
fetchHTML(url: string): Promise<JSDOM>
297
298
}
298
299
` ` `
@@ -320,7 +321,7 @@ fetch 是上面 <a href="#cn-myXCrawl" style="text-decoration: none">myXCrawl</
320
321
- 类型
321
322
322
323
` ` ` ts
323
- function fetchData<T = any>(config: IFetchDataConfig): Promise<T >
324
+ function fetchData<T = any>(config: IFetchDataConfig): Promise<IFetchCommon<T> >
324
325
` ` `
325
326
326
327
- 示例
@@ -347,7 +348,7 @@ fetchFile 是上面 <a href="#cn-myXCrawl" style="text-decoration: none">myXCra
347
348
- 类型
348
349
349
350
` ` ` ts
350
- function fetchFile(config: IFetchFileConfig): Promise<IFetchFile >
351
+ function fetchFile(config: IFetchFileConfig): Promise<IFetchCommon<IFileInfo> >
351
352
` ` `
352
353
353
354
- 示例
@@ -400,13 +401,13 @@ interface IAnyObject extends Object {
400
401
- IMethod
401
402
402
403
` ` ` ts
403
- export type IMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK'
404
+ type IMethod = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK'
404
405
` ` `
405
406
406
407
- IRequestConfig
407
408
408
409
` ` ` ts
409
- export interface IRequestConfig {
410
+ interface IRequestConfig {
410
411
url: string
411
412
method?: IMethod
412
413
headers?: IAnyObject
@@ -434,25 +435,26 @@ interface IFetchBaseConifg {
434
435
}
435
436
` ` `
436
437
437
- - IFetchData
438
+ - IFetchCommon
438
439
439
440
` ` ` ts
440
- type IFetch<T> = {
441
+ type IFetchCommon<T> = {
442
+ id: number
441
443
statusCode: number | undefined
442
- headers: IncomingHttpHeaders // node:http
444
+ headers: IncomingHttpHeaders // node:http type
443
445
data: T
444
446
}[]
445
447
` ` `
446
448
447
- - IFetchFile
449
+ - IFileInfo
448
450
449
451
` ` ` ts
450
- type IFetchFile = {
452
+ interface IFileInfo {
451
453
fileName: string
452
454
mimeType: string
453
455
size: number
454
456
filePath: string
455
- }[]
457
+ }
456
458
` ` `
457
459
458
460
- IXCrawlBaseConifg
@@ -484,4 +486,4 @@ interface IFetchFileConfig extends IFetchBaseConifg {
484
486
485
487
## 更多
486
488
487
- 如有 ** 问题** 或 ** 需求** 请在 https: // github.com/coder-hxl/x-crawl 中提 **Issues** 。
489
+ 如有 ** 问题** 或 ** 需求** 请在 https: // github.com/coder-hxl/x-crawl/issues 中提 **Issues** 。
0 commit comments