Hi people,
First all, english isn´t my native languaje. So, i hope that you can understand me.
I’ve a issue when I try to scraper data of URL with cheerio package. The issue is that when I get de data value, this value i seted with symbols like this: Manuel Aristar�n. I hope to scape this special character and replace to correct characters like Manuel Aristarán. This data is store in a json.
All works fine, but only issue is special characters that i wish to scape and replace for the correct character.
This scraper i run with a route with iron route, like you can see. Maybe I must to set a header for encoding the strings, really i don’t know. I would thanks you for any advice and help.
This is the code that i run for extract and store the info:
Router.route('/scraper/:id_investigador', function(){
this.response.setHeader( 'Access-Control-Allow-Origin', '*' );
this.response.setHeader( 'Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE' );
this.response.setHeader( 'Access-Control-Allow-Headers', 'Content-Type, X-Requested-With, x-request-metadata' );
this.response.setHeader( 'Access-Control-Allow-Credentials', true );
var url = 'https://scholar.google.cl/citations?user=' + id_investigador;
request(url, async function(error, response, html){
if(!error){
var $ = cheerio.load(html);
var autor;
var json_pre = {
autor : ""
};
$('#gsc_prf_in').filter(function(){
var data = $(this);
autor = data.text().trim();
json_pre.autor = autor;
})
}
console.log(json_final);
})
}, {where : "server"});