nodejs通过cheerio实现jquery类似的dom查询功能
npm i cheerio
const fs = require("fs");
const cheerio = require("cheerio");
fs.readFile("./yt.html", "utf-8", (err, data) => {
if (err) throw err; // /user/brhm8900/videos
const $ = cheerio.load(data);
$("#video-title").each(function () {
const title = $(this).text();
if ($(this).text().indexOf("S06E") > -1) {
console.log($(this).attr("href"));
}
});
});