Skip to content

Instantly share code, notes, and snippets.

@summersab
Last active April 2, 2019 20:17
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 summersab/b1da0572aa455f3ccd0138a904f4604e to your computer and use it in GitHub Desktop.
Save summersab/b1da0572aa455f3ccd0138a904f4604e to your computer and use it in GitHub Desktop.
Pure JS Bookmarlket to Invite Facebook Likes to Like Your Page
/**
* Run this through a bookmarklet generator to hex-encode the script, bookmark it, and you're off to the races!
* This script adds in sufficient delays to help prevent Facebook from banning you from using this feature, but there IS a
* daily limit. The script will stop when the limit is reached and the warning box pops up. Wait 24 hours before trying again.
* It also adds a duration counter to the top of the like browser to let you know how much longer the operation will take.
* If FB updates their class names, this bookmarklet may break, and I'll do my best to update this Gist, but no promises.
*/
var i = 0;
if (document.querySelectorAll('#reaction_profile_browser').length == 0) {
if (document.querySelectorAll('#u_0_1a ._4arz span').length) {
document.querySelectorAll('#u_0_1a ._4arz span')[0].click();
}
else if (document.querySelectorAll('#fbPhotoSnowliftFeedback ._1g5v span').length) {
document.querySelectorAll('#fbPhotoSnowliftFeedback ._1g5v span')[0].click();
}
}
setTimeout(function() {
loadMore();
}, 3000);
function loadMore() {
clicked = document.querySelectorAll('#reaction_profile_browser li div div div div._6a._5j0d span > button[disabled="1"]');
for (i = 0; i < clicked.length; i++) {
clicked[i].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.remove();
}
dislikes = document.querySelectorAll('a div span i.sx_2959a0')
for (i = 0; i < dislikes.length; i++) {
dislikes[i].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.remove()
}
document.querySelectorAll('span._2iem._50f7')[0].innerText = 'Loaded ' + document.querySelectorAll('._5i_q').length + ' profiles';
setTimeout(function() {
if (document.querySelectorAll('#reaction_profile_pager .pam.uiBoxLightblue.uiMorePagerPrimary').length != 0) {
document.querySelectorAll('#reaction_profile_pager .pam.uiBoxLightblue.uiMorePagerPrimary')[0].click();
loadMore();
}
else {
likes = document.querySelectorAll('li._5i_q ._5i_t ._6a._6b SPAN a[role="button"][rel="async-post"]._42ft._4jy0._4jy3._517h._51sy');
clickInvite();
}
}, 1000);
}
function timeLeft() {
duration = (likes.length - i) * 5;
var days = Math.floor(duration / 86400);
duration -= days * 86400;
var hours = Math.floor(duration / 3600) % 24;
duration -= hours * 3600;
var minutes = Math.floor(duration / 60) % 60;
duration -= minutes * 60;
var seconds = duration % 60;
document.querySelectorAll('span._2iem._50f7')[0].innerText = 'Time Remaining: Loading: ' + hours + 'h ' + minutes + 'm ' + seconds + 's';
}
function clickInvite() {
setTimeout(function() {
if (typeof(document.querySelectorAll('[data-testid="exception_dialog"]')[0]) != 'undefined') {
if (document.querySelectorAll('[data-testid="exception_dialog"]')[0].textContent.startsWith('You’re Temporarily Blocked')) {
i = likes.length;
}
}
else if (i < likes.length) {
timeLeft();
likes[i].click();
clickInvite();
i++;
}
else {
document.querySelectorAll('[data-testid="reactions_profile_browser:close"]')[0].click();
}
}, 5000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment