const getDataFun=()=>{
const param=data.string
getData(param)
.then((res) => {
const reult=res?.data
const $ = cheerio.load(reult)
const aBox = $('.article-list div').find('.article-title')
console.log(aBox,123)
const arr = []
aBox.each((index, item) => {
const htmlSrc = $(item).find('a').attr('href')
const name = $(item).find('a').text()
const bold = $(item).find('b').text().trim()
arr.push({
htmlSrc,
name,
bold
})
})
console.log(arr,369)
})
.catch((error) => console.log(error))
}
cherrio 使用 ,爬虫
最新推荐文章于 2024-02-06 10:24:20 发布