问题描述
const axios = require('axios');
const cheerio = require('cheerio');
const url = 'somewebsite';
axios(url)
.then(response => {
const html = response.data;
const $ = cheerio.load(html);
const statsTable = $('div[class="*someclassname*"] > P');// this results correct data in browser
console.log(statsTable.textContent);
console.log(statsTable.text());
})
.catch(console.error);
$('div[class="*someclassname*"] > P')
在浏览器控制台中工作正常,但在 node js 中结果未定义,请帮助
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)