Skip to content

Commit 54a574a

Browse files
committed
Update the Chinese document
1 parent bda67b7 commit 54a574a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

document/cn.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,16 @@ import XCrawl from 'x-crawl'
2828
2929
// 2.创建一个爬虫实例
3030
const myXCrawl = new XCrawl({
31-
baseUrl: 'https://www.bilibili.com',
3231
timeout: 10000, // 超时时间
3332
intervalTime: { max: 6000, min: 2000 } // 控制请求频率
3433
})
3534
3635
// 3.调用 fetchHTML API 爬取 HTML
37-
myXCrawl.fetchHTML('/guochuang/').then((res) => {
36+
myXCrawl.fetchHTML('https://www.bilibili.com/guochuang/').then((res) => {
3837
const { jsdom } = res.data // 默认使用了 JSDOM 库解析 HTML
3938
4039
// 3.1.获取轮播图片的 src
41-
const imgSrc: string[] = []
40+
const imgSrc = []
4241
const recomEls = jsdom.window.document.querySelectorAll('.chief-recom-item')
4342
recomEls.forEach((item) => imgSrc.push(item.querySelector('img').src))
4443
@@ -48,7 +47,7 @@ myXCrawl.fetchHTML('/guochuang/').then((res) => {
4847
})
4948
```
5049

51-
**注意:** 请勿随意爬取,这里只是为了演示爬取过程,并将请求频率控制在 6000ms 到 2000ms 内。
50+
**注意:** 请勿随意爬取,这里只是为了演示如何使用 XCrawl ,并将请求频率控制在 6000ms 到 2000ms 内。
5251

5352
## 核心概念
5453

0 commit comments

Comments
 (0)