Skip to content

Instantly share code, notes, and snippets.

@cyrillsemenov
Created January 25, 2023 09:48
Show Gist options
  • Save cyrillsemenov/d72833927e398ac8d68bf8572c2b1f38 to your computer and use it in GitHub Desktop.
Save cyrillsemenov/d72833927e398ac8d68bf8572c2b1f38 to your computer and use it in GitHub Desktop.
This is how you can try to scrape all comments from FB post just using console
let comments = document.querySelectorAll('[role="article"]');
let result = "";
for (let i = 1; i < comments.length-2; i++) {
let data = comments[i].querySelectorAll('span');
result = result + `${i}, \"Name: ${data[5].textContent}\", \"Comment(can be broken): ${data[6].textContent}\",\"Full text: ${data.textContent}\"\n`;
}
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment