Last active
January 12, 2021 21:24
-
-
Save scr2em/d82e663f152b275b2b44a6c48d04aed7 to your computer and use it in GitHub Desktop.
Facebook random comment picker
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
// open the post in a new tap | |
var commentPicker= function(){ | |
var comments =[]; | |
document.querySelectorAll("li div div div div div div div div div div a").forEach(x=>{ | |
try{ | |
var link = x.href | |
if(link.match('profile.php')){ | |
link = link.split("&")[0] | |
}else{ | |
link = link.split("?")[0] | |
} | |
comments.push({name: x.firstElementChild.firstElementChild.innerHTML,profile:link}) | |
}catch{ | |
} | |
}) | |
var {name,profile} = comments[Math.floor(Math.random()*comments.length)] | |
console.log(`YAY ${name} has won!!! check his profile at ${profile} `) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment