This commit is contained in:
asd
2019-12-07 19:15:34 +08:00
parent 15f5a52bb2
commit 3b94e3974a

View File

@@ -17,13 +17,19 @@ yarn global(是否全局) add koa koa-router superagent cheerio
通过import 引入
2.获取网页内容:
```
superagent.get(''<网址>).end((err,res)=>{
//其中res.text 就是获取的网站内容的源代码
})
```
3.使用cheerio 通过jq分析数据
let $=cheerio.load(res.text)
eg: 获取
eg: 获取所有class="button" 的a标签
let btn=$()