Skip to content

Instantly share code, notes, and snippets.

@mo7amd
Last active March 9, 2019 13:21
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 mo7amd/07577e2394ae19024c5603217fe98617 to your computer and use it in GitHub Desktop.
Save mo7amd/07577e2394ae19024c5603217fe98617 to your computer and use it in GitHub Desktop.
scrap fb_user_ids and name from comments
function getIdsList () {
document.querySelectorAll('a.UFIPagerLink').forEach(el => el.click())
const idSelector = '.UFICommentAuthorWithPresence.img._8o._8s.UFIImageBlockImage';
const namesSelector = `${idSelector} img`;
const el = document.querySelectorAll(idSelector);
const names = document.querySelectorAll(namesSelector);
const ids = [];
el.forEach((auth, index) => {
const link = auth.getAttribute('data-hovercard');
const name = names[index].getAttribute('alt');
const id = link.split('?id=')[1].split('&')[0];
ids.push({
id,
name,
});
})
return ids;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment