Last active
March 9, 2019 13:21
-
-
Save mo7amd/07577e2394ae19024c5603217fe98617 to your computer and use it in GitHub Desktop.
scrap fb_user_ids and name from comments
This file contains 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
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