Skip to content

Commit 3e9c517

Browse files
committed
feat(docs): root is an English document
1 parent 1ba96f0 commit 3e9c517

File tree

140 files changed

+2787
-2976
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+2787
-2976
lines changed

docs/.vitepress/config.ts

Lines changed: 164 additions & 143 deletions
Large diffs are not rendered by default.

docs/.vitepress/theme/style/vars.css

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@
33
* -------------------------------------------------------------------------- */
44

55
:root {
6-
--c-yellow-theme: #feba07;
7-
--c-red-theme: #7c1823;
6+
--c-yellow-theme: #feba07; /* yellow */
7+
--c-golden-yellow-theme: #f26b1f; /* golden yellow */
8+
}
9+
10+
/*
11+
* Colors: Function
12+
* -------------------------------------------------------------------------- */
13+
14+
:root {
15+
--vp-c-brand-1: var(--c-yellow-theme);
16+
--vp-c-brand-2: var(--c-golden-yellow-theme);
817
}
918

1019
/**
1120
* Component: Button
1221
* -------------------------------------------------------------------------- */
1322
:root {
1423
--vp-button-brand-bg: var(--c-yellow-theme);
15-
--vp-button-brand-hover-bg:#e4a507;
24+
--vp-button-brand-hover-bg:var(--c-golden-yellow-theme);
1625
}
1726

1827
/**
@@ -21,7 +30,7 @@
2130

2231
:root {
2332
--vp-home-hero-name-color: transparent;
24-
--vp-home-hero-name-background: linear-gradient(290deg, var(--c-red-theme) 6%, var(--c-yellow-theme));
25-
--vp-home-hero-image-background-image: linear-gradient(180deg, var(--c-yellow-theme) 60%, var(--c-red-theme) 30%);
26-
--vp-home-hero-image-filter: blur(40px);
33+
--vp-home-hero-name-background: linear-gradient(108deg, var(--c-yellow-theme) 30%, var(--c-golden-yellow-theme));
34+
--vp-home-hero-image-background-image: linear-gradient(var(--c-yellow-theme), var(--c-golden-yellow-theme), var(--c-yellow-theme));
35+
--vp-home-hero-image-filter: blur(68px);
2736
}

docs/about/announcements.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# 注意事项
1+
# Precautions
22

3-
- x-crawl 仅供合法用途,禁止使用该工具进行任何违法活动,包括但不限于未经授权的数据采集、网络攻击、隐私侵犯等行为。
4-
- 在进行数据采集之前,请确保您已经获得了目标网站的明确授权,并遵守其 robots.txt 文件规定以及使用条款。
5-
- 避免对目标网站造成过大的访问压力,以免触发其反爬策略或造成服务器宕机。
3+
- x-crawl is for legal purposes only. It is prohibited to use this tool to conduct any illegal activities, including but not limited to unauthorized data collection, network attacks, privacy violations, etc.
4+
- Before collecting data, make sure you have explicit authorization from the target website and comply with its robots.txt file and terms of use.
5+
- Avoid placing excessive access pressure on the target website to avoid triggering its anti-crawling strategy or causing server downtime.

docs/about/community.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# 社区
1+
# Community
22

3-
- **Discord 聊天:** 通过 [Discord](https://discord.gg/SF7aaebg4E) 与其他 x-crawl 用户实时提问和讨论(提前了解关于 x-crawl 的动态)。
4-
- **GitHub 讨论:** 使用 [GitHub 讨论](https://github.com/coder-hxl/x-crawl/discussions) 来进行留言板式的问题和讨论。
3+
- **Discord Chat:** Ask and discuss with other x-crawl users in real time via [Discord](https://discord.gg/SF7aaebg4E) (keep up to date on x-crawl news in advance).
4+
- **GitHub Discussions:** Use [GitHub Discussions](https://github.com/coder-hxl/x-crawl/discussions) for message board-style questions and discussions.
55

6-
不得提交与任何非法活动相关的问题和讨论。x-crawl 仅供合法用途,禁止使用该工具进行任何违法活动,包括但不限于未经授权的数据采集、网络攻击、隐私侵犯等行为。请确保您的使用行为始终符合法律法规和道德标准,共同维护一个安全、合法的网络环境。
6+
Questions and discussions related to any illegal activity may not be submitted. x-crawl is for legal purposes only, and it is prohibited to use this tool to conduct any illegal activities, including but not limited to unauthorized data collection, network attacks, privacy violations, etc. Please ensure that your usage behavior always complies with laws, regulations and ethical standards, and jointly maintain a safe and legal network environment.

docs/about/faq.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
# 常见问题
1+
# common problem
22

3-
## crawlPage API puppeteer 的关系
3+
## The relationship between crawlPage API and puppeteer
44

5-
crawlPage API 内置了 [puppeteer](https://github.com/puppeteer/puppeteer) ,您只需要传入一些配置选项即可让 x-crawl 帮助您简化操作,并拿到完好无损的 Brower 实例和 Page 实例,x-crawl 并不会对其重写。
5+
The crawlPage API has built-in [puppeteer](https://github.com/puppeteer/puppeteer). You only need to pass in some configuration options to let x-crawl help you simplify the operation and get intact Brower instances and Pages. instance, x-crawl does not override it.
66

7-
## 使用 crawlPage API 造成程序崩溃
7+
## Using crawlPage API causes the program to crash
88

9-
如果你需要在一个 crawlPage 爬取很多页面,建议在每个页面爬下来后,用 [onCrawlItemComplete 生命周期函数](#onCrawlItemComplete) 来处理每个目标的结果并关闭 page 实例,如果不进行关闭操作,则可能因开启的 page 过多而造成程序崩溃(跟自身设备性能有关)。
9+
If you need to crawl many pages in one crawlPage, it is recommended that after crawling each page, use [onCrawlItemComplete life cycle function] (#onCrawlItemComplete) to process the results of each target and close the page instance. If no shutdown operation is performed, then The program may crash due to too many pages being opened (related to the performance of the device itself).
1010

1111
```js{11,12,13,14,15,16,,17,,18,35,36,37,38,39,40}
1212
import { createCrawl } from 'x-crawl'
1313
1414
const crawlApp = createCrawl()
1515
16-
// 爬取目标少的推荐
16+
// Recommendations with few crawling targets
1717
crawlApp
18-
.crawlPage([
19-
'https://www.example.com/page-1',
20-
'https://www.example.com/page-2'
21-
])
22-
.then((results) => {
23-
for (const itemResult of results) {
24-
const { page } = itemResult.data
25-
26-
// 后续不再使用就关闭
27-
page.close()
28-
}
29-
})
30-
31-
// 爬取目标多的推荐
32-
// 通过进阶配置的 onCrawlItemComplete
18+
.crawlPage([
19+
'https://www.example.com/page-1',
20+
'https://www.example.com/page-2'
21+
])
22+
.then((results) => {
23+
for (const itemResult of results) {
24+
const { page } = itemResult.data
25+
26+
//Close if no longer used
27+
page.close()
28+
}
29+
})
30+
31+
// Crawling recommendations with many targets
32+
//onCrawlItemComplete through advanced configuration
3333
crawlApp.crawlPage({
34-
targets: [
35-
'https://www.example.com/page-1',
36-
'https://www.example.com/page-2',
37-
'https://www.example.com/page-3',
38-
'https://www.example.com/page-4',
39-
'https://www.example.com/page-5',
40-
'https://www.example.com/page-6',
41-
'https://www.example.com/page-7',
42-
'https://www.example.com/page-8',
43-
'https://www.example.com/page-9',
44-
'https://www.example.com/page-10'
45-
],
46-
onCrawlItemComplete(crawlPageSingleResult) {
47-
const { page } = crawlPageSingleResult.data
48-
49-
// 后续不再使用就关闭
50-
page.close()
51-
}
34+
targets: [
35+
'https://www.example.com/page-1',
36+
'https://www.example.com/page-2',
37+
'https://www.example.com/page-3',
38+
'https://www.example.com/page-4',
39+
'https://www.example.com/page-5',
40+
'https://www.example.com/page-6',
41+
'https://www.example.com/page-7',
42+
'https://www.example.com/page-8',
43+
'https://www.example.com/page-9',
44+
'https://www.example.com/page-10'
45+
],
46+
onCrawlItemComplete(crawlPageSingleResult) {
47+
const { page } = crawlPageSingleResult.data
48+
49+
//Close if no longer used
50+
page.close()
51+
}
5252
})
5353
```

docs/about/issues.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Issues
1+
#Issues
22

3-
如果您有 **问题 、需求、好的建议** 可以在 [GitHub Issues](https://github.com/coder-hxl/x-crawl/issues) 中提 **Issues**
3+
If you have **questions, requirements, and good suggestions**, you can raise **Issues** in [GitHub Issues](https://github.com/coder-hxl/x-crawl/issues).

docs/about/old-docs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# 旧版本文档
1+
# Old version documentation
22

3-
v9.0.0 版本:https://github.com/coder-hxl/x-crawl/blob/v9.0.0/docs/cn.md
3+
v9.0.0 version: https://github.com/coder-hxl/x-crawl/blob/v9.0.0/docs/cn.md

docs/about/releases.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# 版本发布
1+
# Version release
22

3-
完整的过往发布记录可以在 [GitHub](https://github.com/coder-hxl/x-crawl/blob/main/CHANGELOG.md) 查阅。
3+
The complete past release record can be viewed at [GitHub](https://github.com/coder-hxl/x-crawl/blob/main/CHANGELOG.md).

docs/api/crawl-data.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# crawlData
22

3-
crawl 是爬虫实例的方法,通常用于爬取 API ,可获取 JSON 数据等等。
3+
crawl is a method of crawler instance, usually used to crawl API, obtain JSON data, etc.
44

5-
## 类型
5+
## type
66

7-
crawlData API 是一个函数。类型是 [重载函数](https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads) 可以通过不同的配置参数调用该函数(在类型方面)。
7+
crawlData API is a function. A type is an [overloaded function](https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads) that can be called with different configuration parameters (in terms of type).
88

99
```ts
1010
type crawlData = {
@@ -24,16 +24,16 @@ type crawlData = {
2424
}
2525
```
2626
27-
**参数类型:**
27+
**Parameter Type:**
2828
29-
- 查看 [CrawlDataDetailTargetConfig](#CrawlDataDetailTargetConfig) 类型
30-
- 查看 [CrawlDataAdvancedConfig](#CrawlDataAdvancedConfig) 类型
29+
- View the [CrawlDataDetailTargetConfig](#CrawlDataDetailTargetConfig) type
30+
- View the [CrawlDataAdvancedConfig](#CrawlDataAdvancedConfig) type
3131
32-
**返回值类型:**
32+
**Return value type:**
3333
34-
- 查看 [CrawlDataSingleResult](#CrawlDataSingleResult) 类型
34+
- View the [CrawlDataSingleResult](#CrawlDataSingleResult) type
3535
36-
## 示例
36+
## Example
3737
3838
```js
3939
import { createCrawl } from 'x-crawl'
@@ -56,18 +56,18 @@ crawlApp
5656
})
5757
```
5858

59-
## 配置
59+
## Configuration
6060

61-
一共有 4 种:
61+
There are 4 types in total:
6262

63-
- 简单目标配置 - string
64-
- 详细目标配置 - CrawlDataDetailTargetConfig
65-
- 混合目标数组配置 - (string | CrawlDataDetailTargetConfig)[]
66-
- 进阶配置 - CrawlDataAdvancedConfig
63+
- Simple target configuration - string
64+
- Detailed target configuration - CrawlDataDetailTargetConfig
65+
- Mixed target array configuration - (string | CrawlDataDetailTargetConfig)[]
66+
- Advanced configuration - CrawlDataAdvancedConfig
6767

68-
### 简单目标配置 - string
68+
### Simple target configuration - string
6969

70-
这是简单目标配置。如果你只想单纯爬一下这个数据,并且该接口是 GET 方式的,可以试试这种写法:
70+
This is a simple target configuration. If you just want to simply crawl this data, and the interface is GET, you can try this way of writing:
7171

7272
```js
7373
import { createCrawl } from 'x-crawl'
@@ -77,11 +77,11 @@ const crawlApp = createCrawl()
7777
crawlApp.crawlData('https://www.example.com/api').then((res) => {})
7878
```
7979

80-
拿到的 res 将是一个对象。
80+
The res obtained will be an object.
8181

82-
### 详细目标配置 - CrawlDataDetailTargetConfig
82+
### Detailed target configuration - CrawlDataDetailTargetConfig
8383

84-
这是详细目标配置。如果你想爬一下这个数据,并且需要失败重试之类的,可以试试这种写法:
84+
This is the detailed target configuration. If you want to crawl this data and need to retry after failure, you can try this way of writing:
8585

8686
```js
8787
import { createCrawl } from 'x-crawl'
@@ -97,13 +97,13 @@ crawlApp
9797
.then((res) => {})
9898
```
9999

100-
拿到的 res 将是一个对象。
100+
The res obtained will be an object.
101101

102-
更多配置选项可以查看 [CrawlDataDetailTargetConfig](#CrawlDataDetailTargetConfig)
102+
For more configuration options, see [CrawlDataDetailTargetConfig](#CrawlDataDetailTargetConfig).
103103

104-
### 混合目标数组配置 - (string | CrawlDataDetailTargetConfig)[]
104+
### Mixed target array configuration - (string | CrawlDataDetailTargetConfig)[]
105105

106-
这是混合目标数组配置。如果你想爬取多个数据,并且有些数据需要失败重试之类的,可以试试这种写法:
106+
This is a mixed target array configuration. If you want to crawl multiple data, and some data needs to be failed and retried, you can try this way of writing:
107107

108108
```js
109109
import { createCrawl } from 'x-crawl'
@@ -118,13 +118,13 @@ crawlApp
118118
.then((res) => {})
119119
```
120120

121-
拿到的 res 将是一个数组,里面是对象。
121+
The res obtained will be an array containing objects.
122122

123-
更多配置选项可以查看 [CrawlDataDetailTargetConfig](#CrawlDataDetailTargetConfig)
123+
For more configuration options, see [CrawlDataDetailTargetConfig](#CrawlDataDetailTargetConfig).
124124

125-
### 进阶配置 - CrawlDataAdvancedConfig
125+
### Advanced configuration - CrawlDataAdvancedConfig
126126

127-
这是进阶配置,targets 是混合目标数组配置。如果你想爬取多个数据,并且爬取目标配置(proxycookies、重试等等)不想重复写,还需要间隔时间、设备指纹以及生命周期等等,可以试试这种写法:
127+
This is an advanced configuration, targets is a mixed target array configuration. If you want to crawl multiple data, and you don’t want to write the crawling target configuration (proxy, cookies, retry, etc.) repeatedly, and you also need interval time, device fingerprint, life cycle, etc., you can try this way of writing:
128128

129129
```js
130130
import { createCrawl } from 'x-crawl'
@@ -144,8 +144,8 @@ crawlApp
144144
.then((res) => {})
145145
```
146146

147-
拿到的 res 将是一个数组,里面是对象。
147+
The res obtained will be an array containing objects.
148148

149-
更多配置选项可以查看 [CrawlDataAdvancedConfig](#CrawlDataAdvancedConfig)
149+
For more configuration options, see [CrawlDataAdvancedConfig](#CrawlDataAdvancedConfig).
150150

151-
关于结果的更多信息可查看 [关于结果](#关于结果) ,可以根据实际情况选用即可。
151+
For more information about the results, please view [About the results](#About the results). You can choose it according to the actual situation.

0 commit comments

Comments
 (0)