Código:
app.get('/', function (req, res) {
res.render('index', { title: 'Hey', message: 'Hello there!' })
});
request({url : 'http://www.laliga.es/laliga-santander/barcelona', encoding: 'binary'},
function(err, resp, body) {
if(!err && resp.statusCode == 200) {
var $ = cheerio.load(body);
$('#zona-graficos #grafico-jugados .valor').each(function(){
let partidos = $(this).html();
console.log('Partidos jugados: ' + partidos);
});
$('#zona-graficos #grafico-victorias .valor').each(function(){
let victorias = $(this).html();
console.log('Victorias: ' + victorias);
});
}
});
res.render('index', { title: 'Hey', message: 'Hello there!' })
});
request({url : 'http://www.laliga.es/laliga-santander/barcelona', encoding: 'binary'},
function(err, resp, body) {
if(!err && resp.statusCode == 200) {
var $ = cheerio.load(body);
$('#zona-graficos #grafico-jugados .valor').each(function(){
let partidos = $(this).html();
console.log('Partidos jugados: ' + partidos);
});
$('#zona-graficos #grafico-victorias .valor').each(function(){
let victorias = $(this).html();
console.log('Victorias: ' + victorias);
});
}
});