Unable to scrape the link from the element below using 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);`
I tried to select the class in the code above by using $('a.btn._def._i._sm', hmtl) but its not working.I keep getting null.
enter image description here
Please has anyone encountered this issue before and how did they solve it?
question from:
https://stackoverflow.com/questions/65904833/unable-to-scrape-the-link-in-a-class-btn-def-i-sm-href-www-page2-com-us 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…