Created
September 24, 2016 16:25
-
-
Save pechitook/58600db87205d06ea302cbf7511c9ea1 to your computer and use it in GitHub Desktop.
Instagram scripts to automate common tasks
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
clickAndWait = (cb, ms = 2000) => { | |
setTimeout(cb, ms) | |
} | |
openFirstPhoto = () => { | |
document.querySelectorAll('._nljxa')[0].childNodes[0].childNodes[0].click() | |
} | |
likePhoto = () => { | |
document.querySelectorAll('.coreSpriteHeartOpen')[0].click() | |
} | |
nextPhoto = () => { | |
document.querySelectorAll('.coreSpriteRightPaginationArrow')[0].click() | |
} | |
getWaitingTime = (min = 1, max = 5) => (Math.floor(Math.random() * (max - min + 1)) + min) * 1000 | |
// open first photo of desired hashtag and run | |
startLikingPhotos = () => { | |
setInterval(() => { | |
clickAndWait(likePhoto) | |
clickAndWait(nextPhoto) | |
}, getWaitingTime()) | |
} | |
// open the following panel and run | |
startUnfollowingPeople = () => { | |
let i = 0 | |
document.querySelectorAll('._aj7mu._r4e4p._95tat._o0442').forEach((button) => { | |
i++ | |
setTimeout(() => { | |
button.click() | |
}, 3000*i) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment