我正在尝试抓取一个网站:http ://www.vehiculo-robado.com但正在返回给我这个:
error: null
statusCode: 200
body: <html style="height:100%"><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><meta name="format-detection" content="telephone=no"><meta name="viewport" content="initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"></head><body style="margin:0px;height:100%"><iframe src="/_Incapsula_Resource?CWUDNSAI=9&xinfo=6-31980899-0%202NNN%20RT%281508782951589%204%29%20q%280%20-1%20-1%20-1%29%20r%280%20-1%29%20B12%284%2c315%2c0%29&incident_id=874000030218433631-157072954141311030&edet=12&cinfo=04000000" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 874000030218433631-157072954141311030</iframe></body></html>
网络上有 html...
这是我抓取网络的中间件:
const request = require('request');
function webScraped(req,res,next){
const url = `http://www.vehiculo-robado.com`
req.webParsed = function webToScrape (callback){
request(url, function(error, response, body){
console.log('error:', error);
console.log('statusCode:', response && response.statusCode);
console.log('body =========>', body)
return callback(false, body);
})
}
next()
}
module.exports = webScraped
我尝试使用其他网站,如谷歌,它返回我的 html 很好。我不知道我做错了什么。