Skip to content

Commit 015fb32

Browse files
committed
docs: jump to a detailed type
1 parent 9caee8d commit 015fb32

File tree

6 files changed

+68
-20
lines changed

6 files changed

+68
-20
lines changed

README.md

+21-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# x-crawl
22

3-
English | [简体中文](https://github.com/coder-hxl/x-crawl/blob/main/document/cn.md)
3+
English | [简体中文](https://github.com/coder-hxl/x-crawl/blob/main/docs/cn.md)
44

55
XCrawl is a Nodejs multifunctional crawler library.
66

77
## Feature
88

99
- Crawl HTML, JSON, file resources, etc. with simple configuration
1010
- Use the JSDOM library to parse HTML, or parse HTML by yourself
11-
- The request method supports asynchronous/synchronous
12-
- Support Promise/Callback
11+
- Support asynchronous/synchronous way to crawl data
12+
- Support Promise/Callback way to get the result
1313
- Polling function
1414
- Anthropomorphic request interval
1515
- Written in TypeScript
@@ -87,10 +87,12 @@ docsXCrawl.fetchHTML('/zh/get-started').then((res) => {
8787
8888
### XCrawl
8989
90-
Create a crawler instance via new XCrawl. The request queue is maintained by the instance method itself and is not shared.
90+
Create a crawler instance via new XCrawl. The request queue is maintained by the instance method itself, not by the instance itself.
9191
9292
#### Type
9393
94+
For more detailed types, please see the [Types](#Types) section
95+
9496
```ts
9597
class XCrawl {
9698
constructor(baseConfig?: IXCrawlBaseConifg)
@@ -159,6 +161,9 @@ fetchHTML is the method of the above [myXCrawl](https://github.com/coder-hxl/x-c
159161
160162
#### Type
161163
164+
- Look at the [IFetchHTMLConfig](#IFetchHTMLConfig) type
165+
- Look at the [IFetchHTML](#IFetchHTML) type
166+
162167
```ts
163168
fetchHTML(
164169
config: IFetchHTMLConfig,
@@ -181,6 +186,10 @@ fetchData is the method of the above [myXCrawl](#Example-1) instance, which is u
181186
182187
#### Type
183188
189+
- Look at the [IFetchDataConfig](#IFetchDataConfig) type
190+
- Look at the [IFetchCommon](#IFetchCommon) type
191+
- Look at the [IFetchCommonArr](#IFetchCommonArr) type
192+
184193
```ts
185194
fetchData<T = any>(
186195
config: IFetchDataConfig,
@@ -211,6 +220,11 @@ fetchFile is the method of the above [myXCrawl](#Example-1) instance, which is u
211220
212221
#### Type
213222
223+
- Look at the [IFetchFileConfig](#IFetchFileConfig) type
224+
- Look at the [IFetchCommon](#IFetchCommon) type
225+
- Look at the [IFetchCommonArr](#IFetchCommonArr) type
226+
- Look at the [IFileInfo](#IFileInfo) type
227+
214228
```ts
215229
fetchFile(
216230
config: IFetchFileConfig,
@@ -243,6 +257,8 @@ fetchPolling is a method of the [myXCrawl](#Example-1) instance, typically used
243257
244258
#### Type
245259
260+
- Look at the [IFetchPollingConfig](#IFetchPollingConfig) type
261+
246262
```ts
247263
function fetchPolling(
248264
config: IFetchPollingConfig,
@@ -361,7 +377,7 @@ interface IFetchPollingConfig {
361377
interface IFetchCommon<T> {
362378
id: number
363379
statusCode: number | undefined
364-
headers: IncomingHttpHeaders // node:http 类型
380+
headers: IncomingHttpHeaders // node:http type
365381
data: T
366382
}
367383
```

document/cn.md renamed to docs/cn.md

+23-7
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
XCrawl 是 Nodejs 多功能爬虫库。
66

7-
## 特点
7+
## 特征
88

99
- 只需简单的配置即可抓取 HTML 、JSON、文件资源等等
1010
- 使用 JSDOM 库对 HTML 解析,也可自行解析 HTML
11-
- 请求方式支持 异步/同步
12-
- 支持 Promise/Callback
11+
- 支持 异步/同步 方式爬取数据
12+
- 支持 Promise/Callback 方式获取结果
1313
- 轮询功能
1414
- 拟人化的请求间隔时间
1515
- 使用 TypeScript 编写
@@ -20,7 +20,7 @@ XCrawl 是 Nodejs 多功能爬虫库。
2020
- [示例](#示例)
2121
- [核心概念](#核心概念)
2222
* [XCrawl](#XCrawl)
23-
+ [类型](#Type-1)
23+
+ [类型](#类型-1)
2424
+ [示例](#示例-1)
2525
+ [模式](#模式)
2626
+ [间隔时间](#间隔时间)
@@ -99,10 +99,12 @@ myXCrawl.fetchPolling({ d: 1 }, () => {
9999
100100
### XCrawl
101101
102-
通过 new XCrawl 创建一个爬虫实例。请求队列是由实例方法内部自己维护,并非共享的
102+
通过 new XCrawl 创建一个爬虫实例。请求队列是由实例方法内部自己维护,并非由实例自己维护
103103
104104
#### 类型
105105
106+
更详细的类型请看[类型](#类型-6)部分内容
107+
106108
```ts
107109
class XCrawl {
108110
constructor(baseConfig?: IXCrawlBaseConifg)
@@ -171,6 +173,9 @@ fetchHTML 是 [myXCrawl](https://github.com/coder-hxl/x-crawl/blob/main/document
171173
172174
#### 类型
173175
176+
- 查看 [IFetchHTMLConfig](#IFetchHTMLConfig) 类型
177+
- 查看 [IFetchHTML](#IFetchHTML) 类型
178+
174179
```ts
175180
fetchHTML(
176181
config: IFetchHTMLConfig,
@@ -193,6 +198,10 @@ fetch 是 [myXCrawl](#示例-1) 实例的方法,通常用于爬取 API ,可
193198
194199
#### 类型
195200
201+
- 查看 [IFetchDataConfig](#IFetchDataConfig) 类型
202+
- 查看 [IFetchCommon](#IFetchCommon) 类型
203+
- 查看 [IFetchCommonArr](#IFetchCommonArr) 类型
204+
196205
```ts
197206
fetchData<T = any>(
198207
config: IFetchDataConfig,
@@ -223,6 +232,11 @@ fetchFile 是 [myXCrawl](#示例-1) 实例的方法,通常用于爬取文件
223232
224233
#### 类型
225234
235+
- 查看 [IFetchFileConfig](#IFetchFileConfig) 类型
236+
- 查看 [IFetchCommon](#IFetchCommon) 类型
237+
- 查看 [IFetchCommonArr](#IFetchCommonArr) 类型
238+
- 查看 [IFileInfo](#IFileInfo) 类型
239+
226240
```ts
227241
fetchFile(
228242
config: IFetchFileConfig,
@@ -255,6 +269,8 @@ fetchPolling 是 [myXCrawl](#示例-1) 实例的方法,通常用于进行轮
255269
256270
#### 类型
257271
272+
- 查看 [IFetchPollingConfig](#IFetchPollingConfig) 类型
273+
258274
```ts
259275
function fetchPolling(
260276
config: IFetchPollingConfig,
@@ -373,7 +389,7 @@ interface IFetchPollingConfig {
373389
interface IFetchCommon<T> {
374390
id: number
375391
statusCode: number | undefined
376-
headers: IncomingHttpHeaders // node:http 类型
392+
headers: IncomingHttpHeaders // node: http 类型
377393
data: T
378394
}
379395
```
@@ -400,7 +416,7 @@ interface IFileInfo {
400416
```ts
401417
interface IFetchHTML {
402418
statusCode: number | undefined
403-
headers: IncomingHttpHeaders
419+
headers: IncomingHttpHeaders // node: http 类型
404420
data: {
405421
html: string // HTML String
406422
jsdom: JSDOM // 使用了 jsdom 库对 HTML 解析

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "x-crawl",
4-
"version": "1.1.0",
4+
"version": "1.1.1",
55
"author": "coderHXL",
66
"description": "XCrawl is a Nodejs multifunctional crawler library.",
77
"license": "MIT",

publish/README.md

+21-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# x-crawl
22

3-
English | [简体中文](https://github.com/coder-hxl/x-crawl/blob/main/document/cn.md)
3+
English | [简体中文](https://github.com/coder-hxl/x-crawl/blob/main/docs/cn.md)
44

55
XCrawl is a Nodejs multifunctional crawler library.
66

77
## Feature
88

99
- Crawl HTML, JSON, file resources, etc. with simple configuration
1010
- Use the JSDOM library to parse HTML, or parse HTML by yourself
11-
- The request method supports asynchronous/synchronous
12-
- Support Promise/Callback
11+
- Support asynchronous/synchronous way to crawl data
12+
- Support Promise/Callback way to get the result
1313
- Polling function
1414
- Anthropomorphic request interval
1515
- Written in TypeScript
@@ -87,10 +87,12 @@ docsXCrawl.fetchHTML('/zh/get-started').then((res) => {
8787
8888
### XCrawl
8989
90-
Create a crawler instance via new XCrawl. The request queue is maintained by the instance method itself and is not shared.
90+
Create a crawler instance via new XCrawl. The request queue is maintained by the instance method itself, not by the instance itself.
9191
9292
#### Type
9393
94+
For more detailed types, please see the [Types](#Types) section
95+
9496
```ts
9597
class XCrawl {
9698
constructor(baseConfig?: IXCrawlBaseConifg)
@@ -159,6 +161,9 @@ fetchHTML is the method of the above [myXCrawl](https://github.com/coder-hxl/x-c
159161
160162
#### Type
161163
164+
- Look at the [IFetchHTMLConfig](#IFetchHTMLConfig) type
165+
- Look at the [IFetchHTML](#IFetchHTML) type
166+
162167
```ts
163168
fetchHTML(
164169
config: IFetchHTMLConfig,
@@ -181,6 +186,10 @@ fetchData is the method of the above [myXCrawl](#Example-1) instance, which is u
181186
182187
#### Type
183188
189+
- Look at the [IFetchDataConfig](#IFetchDataConfig) type
190+
- Look at the [IFetchCommon](#IFetchCommon) type
191+
- Look at the [IFetchCommonArr](#IFetchCommonArr) type
192+
184193
```ts
185194
fetchData<T = any>(
186195
config: IFetchDataConfig,
@@ -211,6 +220,11 @@ fetchFile is the method of the above [myXCrawl](#Example-1) instance, which is u
211220
212221
#### Type
213222
223+
- Look at the [IFetchFileConfig](#IFetchFileConfig) type
224+
- Look at the [IFetchCommon](#IFetchCommon) type
225+
- Look at the [IFetchCommonArr](#IFetchCommonArr) type
226+
- Look at the [IFileInfo](#IFileInfo) type
227+
214228
```ts
215229
fetchFile(
216230
config: IFetchFileConfig,
@@ -243,6 +257,8 @@ fetchPolling is a method of the [myXCrawl](#Example-1) instance, typically used
243257
244258
#### Type
245259
260+
- Look at the [IFetchPollingConfig](#IFetchPollingConfig) type
261+
246262
```ts
247263
function fetchPolling(
248264
config: IFetchPollingConfig,
@@ -361,7 +377,7 @@ interface IFetchPollingConfig {
361377
interface IFetchCommon<T> {
362378
id: number
363379
statusCode: number | undefined
364-
headers: IncomingHttpHeaders // node:http 类型
380+
headers: IncomingHttpHeaders // node:http type
365381
data: T
366382
}
367383
```

publish/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "x-crawl",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"author": "coderHXL",
55
"description": "XCrawl is a Nodejs multifunctional crawler library.",
66
"license": "MIT",

test/start/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)