I\'m trying to extract email info from HTML files in my hard drive.
If I load the file in firefox and run jQuerify bookmarklet I can use successfully the following selec
Cheerio is a server implementation of core jQuery that is perfect for using selectors.
You can easily use the each function:
$('a.iEmail').each(function (i, elem) {
console.log($(this).attr('href'));
});
Full example:
var fs = require('fs');
var cheerio = require('cheerio');
fs.readFile('file_1.html', 'utf-8', function (err, data) {
if (err) {
throw err;
}
var $ = cheerio.load(data);
$('a.iEmail').each(function (i, elem) {
console.log($(this).attr('href'));
});
});