Skip to content

Instantly share code, notes, and snippets.

@EricTendian
Last active August 29, 2015 14:17
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 EricTendian/738e438d26246f82c6ce to your computer and use it in GitHub Desktop.
Save EricTendian/738e438d26246f82c6ce to your computer and use it in GitHub Desktop.
Use this little jQuery script to help create a CSV from a Facebook chat. You'll need to copy the ul element with id webMessengerRecentMessages and everything inside it to a new HTML file, and then include jQuery. From there you can open up devtools, paste in this script, and get an output. Then copy that output into a new textfile, save it, chan…
$("li.webMessengerMessageGroup > div.clearfix > div.clearfix._42ef").each(function () {
var line = '"'+Math.round($(this).find("div.rfloat._ohf abbr").attr("data-utime"))+'","general","'+$(this).find("div:nth-child(2) > strong > a").text()+'",';
$(this).find("div:nth-child(2) > div > div._53 > div").each(function () {
var text = $(this).find("div._38.direction_ltr > span > p").text().replace("\n","\\n");
if (text.length) console.log(line + '"'+text+ "\"\n");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment