項(xiàng)目簡介:
使用 Nodes.js
(以下簡稱Node) 完成
- 爬取一個(gè)傳統(tǒng)靜態(tài)網(wǎng)站, 用
cheerio
庫做頁面解析 - 爬取一個(gè)網(wǎng)絡(luò)API接口數(shù)據(jù)
- 使用JSON文件保存所需數(shù)據(jù)
導(dǎo)出到 excel 或數(shù)據(jù)庫
1. 使用模塊如下:
"dependencies": {
"cheerio": "^1.0.0-rc.2",
"dateformat": "^3.0.2"
}
此外, 使用了 Node 內(nèi)置模塊 fs
request
2. 執(zhí)行: 切換到項(xiàng)目目錄
npm test
// 或者
node index.js
3. 項(xiàng)目地址 https://github.com/wiviwiv/web-crawler
流程
構(gòu)造URL ===>
爬取檢查 robots.txt===> 清洗數(shù)據(jù) ===> 存儲(chǔ)文件
未完待續(xù) 。。国葬。