Created
May 13, 2021 16:20
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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