const cheerio = require('cheerio');
const $ = cheerio.load(html); // your html
//如果有多少script脚本标签使用循环来获取
$('script').map(function(i, el) {
// 建议这里打印$(this) 因为this的对象可能不同
//因为存在script标签为空的数据, 所以判断children长度是否大于0
});
 

 

相关文章: