NODE error html.split is not a function

0
var request = require('request')
var cheerio = require('cheerio');
var arquivo = require('fs');
var innertext = require('innertext');

request('seu link aqui', function(err, res, body){
    if(err) console.log('Erro:' + err)

This code is returning the html.split is not a function at the Node prompt. could you help me?

    var $ = cheerio.load(body);
    var cap = '';
    $('.fr-view').each(function()
    {
        cap = $(this).find('p'); 
        //console.log('cap: '+ cap);
    });

    var texto = '';
    console.log(cap[0]);
    var titulo = innertext(cap[0]);
    console.log('cap: '+ titulo);

    for (x = 0; x < cap.length; x++)
    {
        texto += cap[x].innerText + '\n';
    }
    arquivo.appendFile(titulo +'.txt',texto);
});
    
asked by anonymous 27.09.2018 / 06:47

0 answers