用 cheerio 清空输出
Empty output scraping with cheerio
最近几天我一直在玩 Node 和 CheerioJS,玩得很开心。我想抓取此网页,但由于某种原因,我得到了一个空字符串。很奇怪,因为这种确切的方法似乎适用于其他网站。
这是我设置的:
const rp = require('request-promise');
const cheerio = require('cheerio');
const bread = {
uri: `https://www.ah.nl/producten/product/wi112339/ah-tijger-bruin-heel`,
transform: function(body) {
return cheerio.load(body);
}
};
rp(bread).then(($) => {
console.log($('.product__summary').text());
}).catch((err) => {
console.log(err);
});
我要获取产品描述:
screenshot of this 页面,但我总是返回一个空字符串。我在这里做错了什么?
谢谢!
最近几天我一直在玩 Node 和 CheerioJS,玩得很开心。我想抓取此网页,但由于某种原因,我得到了一个空字符串。很奇怪,因为这种确切的方法似乎适用于其他网站。
这是我设置的:
const rp = require('request-promise');
const cheerio = require('cheerio');
const bread = {
uri: `https://www.ah.nl/producten/product/wi112339/ah-tijger-bruin-heel`,
transform: function(body) {
return cheerio.load(body);
}
};
rp(bread).then(($) => {
console.log($('.product__summary').text());
}).catch((err) => {
console.log(err);
});
我要获取产品描述: screenshot of this 页面,但我总是返回一个空字符串。我在这里做错了什么?
谢谢!