【发布时间】:2021-11-07 20:04:55
【问题描述】:
您好,尝试使用cheerio 抓取此https://davesgarden.com/guides/pf/finder/index.php?sname=Hibiscus&page=1,并且可以访问一些元素,例如菜单项,但不能访问我需要的植物名称。我使用此代码尝试获取植物名称
const $ = cheerio.load(data);
$('#contAfterAds > div > div.plant-info > div > a').each((_idx, el) => {
const postTitle = $(el).text()
postTitles.push(postTitle)
});
但没有运气,有什么建议吗?看到角位不能被刮掉,会不会是类似的问题?
【问题讨论】:
标签: javascript web-scraping jquery-selectors cheerio