Scraper with Node.js and Cheerio

Try to get the names of the mates in the "Starting Soon" section of this website: https://favbet.com/en/bets/

This is my code:

var request = require('request'),
        cheerio = require('cheerio');
        matches = [];

    request('https://favbet.com/en/bets/', function(err, resp, body){
        if (!err && resp.statusCode == 200) {
            var $ = cheerio.load(body);
            var content = $('#startsoon').find('li.col20').each(function() {
                var match = this.text();
                matches.push(match);
            });
            console.log(matches);
        }
    });

      

Console.log returns an empty array. I don't quite understand how deep nesting works in this case.

+3
javascript jquery node.js cheerio


source to share


No one has answered this question yet

Check out similar questions:

2237
How do I pass command line arguments to a Node.js program?
2201
How do you decide when to use Node.js?
1648
How to exit Node.js
1517
How do I debug Node.js applications?
1500
Writing Files in Node.js
1388
What is the purpose of Node.js module.exports and how do you use it?
1264
How to get started with Node.js
1116
Reading environment variables in Node.js
1045
Check synchronously if file / directory exists in Node.js
890
How do I parse JSON using Node.js?



All Articles
Loading...
X
Show
Funny
Dev
Pics