I'm extracting the data from a page, but I get this error
TypeError: $ .find is not a function`
I already installed cheerio
. When I put trm = $.find(.item-row[data-item='TRM']).find(.item-value > span);
is when the error comes out, I get the data but this error comes out.
Code:
const express = require(express);
const app = express();
const https = require('https');
const cheerio = require('cheerio');
app.get('/', function(req, res) {
res.send('express test');
});
https.get('https://widgetsdataifx.blob.core.windows.net/semana/semanaindicators', (resp) => {
let data = '';
resp.on('data', (chunk) => {
data += chunk;
});
resp.on('end', () => {
var $ = cheerio.load(data);
trm = $.find(.item-row[data-item='TRM']).find(.item-value > span);
});
}).on(error, (err) => {
console.log(Error: + err.message);
});