I'm trying to recover the price of an article on GearBest. For that, I use Cheerio to do webscraping. I created a little script (I'm using NodeJS) but I still get the same error : "Error: read ECONNRESET". I have done some research but I can't solve the error.
Here's my code :
// https://www.gearbest.com/laptops/pp_786411.html')
//<span class="goodsIntro_price js-currency js-panelIntroPrice" data-currency="939.99" data-wrap="0" data-round="2">€836.60</span>
const cheerio = require('cheerio')
const port = 8080;
const express = require('express')
const app = express()
const request = require('request')
var url = 'https://www.gearbest.com/laptops/pp_786411.html'
request(url, (error, response, html) => {
if(!error && response.statusCode == 200){
const $ = cheerio.load(html)
const siteHeader = $('.js-panelIntroNormalPrice')
console.log(siteHeader.text())
} else {
console.log('Erreur : ' + error)
//console.log('Http code : ' + response.statusCode)
}
})
This error appear when your connection is interrupted.
Try curl https://www.gearbest.com/laptops/pp_786411.html
if it cannot fetch the page it is a network issue.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments