Skip to content

Instantly share code, notes, and snippets.

@denisemenov
Created October 28, 2017 17:24
Show Gist options
  • Save denisemenov/b46ea56adee60855ca76c047f98c376d to your computer and use it in GitHub Desktop.
Save denisemenov/b46ea56adee60855ca76c047f98c376d to your computer and use it in GitHub Desktop.
Instagram Hashtag or Geotag Autolike
function timeOut(min, max) {
return Math.random() * (max - min + 1000) + min;
}
function getHeartElement() {
var knownHeartElementNames = ["coreSpriteHeartOpen", "coreSpriteLikeHeartOpen"];
var i = 0;
for (i = 0; i < knownHeartElementNames.length; i++) {
var heartElement = document.querySelector('.' + knownHeartElementNames[i]);
if (heartElement !== "undefined") {
break;
}
}
return heartElement;
}
function clickNextElement() {
var nextElement = document.querySelector('.coreSpriteRightPaginationArrow');
nextElement.click();
console.log('Next');
Go();
}
function clickLikeElement() {
var likeElement = getHeartElement();
if (likeElement !== null) {
likeElement.click();
likeCount++;
console.log('Liked ' + likeCount);
doNextElement();
} else {
doNextElement();
}
}
function doNextElement() {
setTimeout(clickNextElement, timeOut(1000, 3000));
}
function doLikeElement() {
setTimeout(clickLikeElement, timeOut(2000, 7000));
}
function Go() {
if (likeCount < 1000) {
doLikeElement();
} else {
console.log('Nice! Time for a break.');
}
}
var likeCount = 0;
Go();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment