问题描述
我在用express,Axios和Cherrio的节点中编写了休闲的Web爬虫代码
<div class="category-title" th:if="(${#locale.language=='ne'} and ${category.np_available}==true) or (${#locale.language=='en'} and ${category.en_available}==false})" th:text="${category.title_np}"></div>
问题是为什么app.get('/',async (req,res) => {
const body = await axios.get(URL);
var item_number = 0;
let $ = cheerio.load(body); //loading of complete HTML body
await $('div.product-Box').each(function (index) {
item_number = item_number + 1;
const price = $(this)
.find('div.product-detail-info>div.product-price')
.find('span.new-price')
.text();
console.log(price);
});
res.render('index',{
number: item_number,});
});
不等待 res.render
解析完成?
我希望提取信息,然后将其呈现在cheerio
文件中。
提前谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)