问题描述
我很久以前就解决了这个问题,但我现在忘记了。 当我的主选择器为
时,我如何访问该日期$('.date')
let cheerio = require('cheerio')
let html = `
<html>
<body>
<span class="date">
<span class="category">Article</span>
Sat,22 Jan 2021 11:12
</span>
</body>
</html>`
let $ = cheerio.load(html)
// Empty
console.log($('.date').next().text())
// Empty
console.log($($('.date').children()[0]).next().next().text())
// Empty
console.log($($('.date').children()[0]).next().text())
// Empty
$('.date').each(el => { console.log($(el).text())})
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)