使用cheerio 获取网站中包含的所有js。我正在获取此 URL https://www.anandtech.com/,当我在网页控制台中使用代码时,它会获取网页上包含的所有 js。
$("script[src]").each(function(i, src) {
console.log($(this).attr("src"));
});
但无法使用cheerio 获取所有js。它只获取几个网址。
干得好!
$("script").map((i,$el) => {
if($(this).attr("src")){
console.log($(this).attr("src"))
}else{
let text = $($el).text()
console.log(text)
}
})
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句