Created
January 10, 2019 13:17
-
-
Save oresh/16590afb600a832102337602b05c47a8 to your computer and use it in GitHub Desktop.
Save chat messages from Facebook
This file contains hidden or 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 messages = document.getElementsByClassName('_3058 _ui9') | |
var name = document.getElementsByClassName('_673w')[0].getElementsByClassName('_3oh-')[0].innerText; | |
[...messages].map( (message) => { | |
var out = ''; | |
out += message.classList.contains('_43by') ? 'Me: ' : name+': '; | |
var text = message.getElementsByClassName('_58nk'); | |
if (text.length) return out + text[0].innerText; | |
}).filter(message => !!message).join('\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment