Skip to content

Instantly share code, notes, and snippets.

@nguy3n47
Last active August 9, 2022 07:36
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 17 You must be signed in to fork a gist
  • Save nguy3n47/d554d93892732b166810886014102043 to your computer and use it in GitHub Desktop.
Save nguy3n47/d554d93892732b166810886014102043 to your computer and use it in GitHub Desktop.
const postID = '4387428904674656'; // 'https://www.facebook.com/LienMinhHuyenThoai/posts/4387428904674656'
const accessToken = ''; // find 'EAAA' at 'https://m.facebook.com/composer/ocelot/async_loader/?publisher=feed'
const url = 'https://graph.facebook.com/' + postID + '/comments?fields=message&access_token=' + accessToken;
const analyze_comments = (url) => {
fetch(url)
.then((response) => response.json())
.then((results) => {
if (results) {
const comments = results.data;
comments.forEach((comment) => {
const message = comment.message.trim();
if (message.length > 0 && message.includes('LOL')) {
let startIndex = message.indexOf('LOL');
let code = message.substr(startIndex, 13);
console.log(code);
}
});
if (typeof results.paging.next !== 'undefined') {
analyze_comments(results.paging.next);
} else {
console.log('Done!');
}
}
})
.catch((error) => {
console.log(error);
});
};
analyze_comments(url);
@Manh3698
Copy link

Manh3698 commented Aug 8, 2021

LOLHXQ6JUVTA2

@dangthanhduy
Copy link

LOLKFEPYQV3YM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment