webesct
- 首先要下载webesct
nom i websect
- 老规矩,还是爬取小米官网的数据QAQ,现在要爬取的是这个:
const $ = require("websect")
const fs = require("fs")
// const cheerio = require("cheerio")
$.get("https://www.mi.com").then(data=>{
var old = Date.now()
var arrs = []
$(data).find("ul.children-list.clearfix li a").each(el=>{
var href = el.href
var src = $(el).find("img").attr("data-src")
var title = $(el).find("div.title").text()
var price = $(el).find("p").text()
arrs.push({
href,src,title,price}