Skip to content

Instantly share code, notes, and snippets.

@conoro
Created May 13, 2021 16:20
Show Gist options
  • Save conoro/a0e12fc876dbeb89e90ab9ccfbfa4550 to your computer and use it in GitHub Desktop.
Save conoro/a0e12fc876dbeb89e90ab9ccfbfa4550 to your computer and use it in GitHub Desktop.
Extract the list of attendees at a Brella-powered conference from the local saved HTML to CSV
var fs = require('fs');
const cheerio = require('cheerio');
const data = fs.readFileSync('Brella_Page1.html');
var $ = cheerio.load(data);
$('.e1h0e2yk3').each(function (i, elem) {
const name = $(this).find(".e1h0e2yk6").text();
const title = $(this).find(".e1h0e2yk7").text();
const desc = $(this).find(".e1h0e2yk9").text();
const line = '"' + name + '", ' + '"' + title + '", ' + '"' + desc + '"\n';
console.log(line);
fs.appendFile('attendees.csv', line, function (err) {
if (err) {
console.log("append failed");
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment