Skip to content

Instantly share code, notes, and snippets.

@kirkins
Created May 31, 2019 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirkins/501dc1860011abc40a98429bbb1d5cb9 to your computer and use it in GitHub Desktop.
Save kirkins/501dc1860011abc40a98429bbb1d5cb9 to your computer and use it in GitHub Desktop.
Extract telegram chat from export
var cheerio = require('cheerio');
var fs = require('fs');
let messageFolder = './messages/';
fs.readdirSync(messageFolder).forEach(file => {
fs.readFile('./'+messageFolder+file, 'utf8', function(err, data) {
if (err) throw err;
var $ = cheerio.load(data);
console.log($('.text').text());
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment