/***
* 888 888 888 d8b .d888
* 888 888 888 Y8P d88P"
* 888 888 888 888
* 88888b. 888 888 88888b. 8888b. 888888 .d88b. .d8888b 88888b. 888 .d88b. 888888
* 888 "88b 888 888 888 "88b "88b 888 d8P Y8b d88P" 888 "88b 888 d8P Y8b 888
* 888 888 888 888 888 888 .d888888 888 88888888 888 888 888 888 88888888 888
* 888 d88P Y88b 888 888 888 888 888 Y88b. Y8b. Y88b. 888 888 888 Y8b. 888
* 88888P" "Y88888 888 888 "Y888888 "Y888 "Y8888 "Y8888P 888 888 888 "Y8888 888
* 888
* Y8b d88P
* "Y88P"
*/
// 1. Log in to instagram and go to https://www.instagram.com/
// 2. Change the start and stop times, min and max amounts
// 3. Run the code in the console
// This likes everything in your feed. Leave the browser tab open and visible!
// You could be blocked by IG if you use this script
// Please feel free to improve this. It's a work in progress just for fun.
function doSomething(random) {
var firstLike = document.querySelector('section.ltpMr.Slqrh > span.fr66n > button > div > span > svg[aria-label="Like"]');
if(firstLike){
firstLike.scrollIntoView({behavior: "smooth", block: "center", inline: "nearest"});
var closestElement = firstLike.closest('button');
console.log('clicked...\n');
closestElement.click();
}
console.log('waiting for '+random+' miliseconds\n');
}
(function loop() {
var min = 10000; // min 10 seconds
var max = 20000; // max 20 seconds
var random = Math.floor(Math.random() * (+max - +min)) + +min;
var today = new Date().getHours();
console.log('current hour: '+today+'\n');
var start = 9; // start liking after this hour
var end = 20; // stop liking after this hour
if (today >= start && today <= end) { // Between
// On
setTimeout(function() {
doSomething(random);
loop();
}, random);
} else {
// Off
if (start < today) {
var diff = start - today;
}else{
var diff = today - start;
}
console.log("diff*3600000: "+Math.abs(diff)*3600000+'\n');
console.log('waiting for '+Math.abs(diff)+' hours until '+start+'\n');
setTimeout(function() {
loop();
}, Math.abs(diff)*3600000);
}
}());
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.