问题描述
无法使用cheerio从下面的元素中抓取链接
const outputFile= 'data.json'
const parsedResults =[]
const pagelimit = 50
let pageCounter = 0
let resultCount = 0
const getWebsiteContent = async(url)=>{
try{
const response = await axios.get(url)
const nextPageLink = $('a.btn._def._i._sm',response.data).attr('href');
console.log(nextPageLink);
}
catch(error){
console.error(error)
}
}
getWebsiteContent(url);`
我尝试使用 $('a.btn._def._i._sm',hmtl) 在上面的代码中选择类,但它不起作用。我一直为空。
请问有没有人遇到过这个问题,他们是如何解决的?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)