1. 程式人生 > >cheerio ==> node中的jquery

cheerio ==> node中的jquery

post agent clas syn per function require func path

三.cheerio ==> node中的jquery https://www.npmjs.com/package/cheerio

$ npm install cheerio -- save

1.cheerio.load ==> 加載HTML文檔

const request = require(‘superagent‘)
const cheerio = require(‘cheerio‘)
const fs = require(‘fs-extra‘)
const path = require(‘path‘)

const url = "https://tieba.baidu.com/p/4885218336?see_lz=1&pn=1";
async function getUrl() {
    const res = await request.get(url);
    const $ = cheerio.load(res.text);
}
getUrl();

cheerio ==> node中的jquery