Created
May 8, 2020 17:56
-
-
Save hddananjaya/b92c402e251fbed259ab1e1524bcf7bf to your computer and use it in GitHub Desktop.
Facebook - Extract group users.
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
var nodes = document.querySelectorAll('[data-name=GroupProfileGridItem]'); | |
var users = []; | |
for (i of nodes){ | |
var name = i.children[1].children[1].children[0].children[1].children[0].textContent | |
var profilePic = i.children[0].children[0].src | |
users.push({name, profilePic}); | |
} | |
console.log(users) | |
# in chrome dev tools we can use copy(object) to copy users. | |
# | |
# And this is a simple stupid page to show extracted data. | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<style> | |
.profile{ | |
display: flex; | |
flex-direction: row; | |
margin:10px; | |
} | |
p{ | |
margin-left: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
<script> | |
let users = [{}] | |
let content = ""; | |
for (i of users){ | |
content += ` | |
<div class='profile'> | |
<img src="${i.profilePic}" > </img> | |
<p>${i.name}</p> <br/> | |
</div> | |
`; | |
} | |
document.write(content) | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment