-
-
Save jadeallencook/139a3d5f9291c2d612d91c8b8c72a755 to your computer and use it in GitHub Desktop.
let likes = 0; | |
setInterval(() => { | |
const heart = document.querySelector('svg[aria-label="Like"][width="24"]'); | |
const arrow = document.querySelector('svg[aria-label="Next"]'); | |
if (heart) { | |
heart.parentNode.parentElement.click() | |
likes++; | |
console.log(`You've liked ${likes} post(s)`); | |
} | |
arrow.parentElement.parentElement.click(); | |
}, 20000); | |
/* | |
let likes = 0; | |
setInterval(() => { | |
const heart = document.querySelector('svg[aria-label="Like"]').parentNode; | |
const arrow = document.querySelector("a.coreSpriteRightPaginationArrow"); | |
if (heart) { | |
heart.click(); | |
likes++; | |
console.log(`You've liked ${likes} post(s)`); | |
} | |
arrow.click(); | |
}, 5000); | |
*/ |
Even if it was changed to setInterval(), you would still face a problem since the rand*1000 in the function will stay as it is first initialized to be (the 'rand' variable will not update). (I am still new to JavaScript though (started last week) so I might be wrong).
I've tried what you did guys, but nothing seems to be working for me. So I build my own version and it works, maybe it's helpful for you too.
let likes = 0;
setInterval(() => {
const node_list = document.querySelectorAll('.wpO6b');
const heart = node_list[1];
const arrow = document.querySelector('a.coreSpriteRightPaginationArrow');
if (heart) {
heart.click();
likes++;
console.log(`You've liked ${likes} post(s)`);
}
arrow.click();
}, 3000);
I've tried what you did guys, but nothing seems to be working for me. So I build my own version and it works, maybe it's helpful for you too.
let likes = 0; setInterval(() => { const node_list = document.querySelectorAll('.wpO6b'); const heart = node_list[1]; const arrow = document.querySelector('a.coreSpriteRightPaginationArrow'); if (heart) { heart.click(); likes++; console.log(`You've liked ${likes} post(s)`); } arrow.click(); }, 3000);
Try checking the element names, they might have changed.
But how do we login? Can you give us the starting line of code
That's great!
how to use this
Is there a function for automatic comments?
And a function for a random like interval?
Thank you @jadeallencook for the script!
Unfortunately, it has stopped working for me. Maybe Instagram changed something.
let likes = 0;
let autoLike = setInterval(() => {
const heart = document.querySelector('svg[aria-label="Like"]');
const arrow = document.querySelector('svg[aria-label="Next"]');
if (heart) {
heart.parentNode.click();
likes++;
console.log(`You've liked ${likes} post(s)`);
}
arrow.parentElement.click();
}, 5000);
I edited the code very little.
I have put the "setInterval" inside a variable, so that it can be stopped by writing:
clearInterval(autoLike);
can somebody elabrate how to use the code
@microhacker0891 Open an Instagram post, copy and paste it inside your browser’s console and click enter or use a browser extension like Tempermonkey
@microhacker0891 Just open some post on Instagram where you have an arrow to go to the next post, press F12
on your keyboard, then switch to the tab Console
, paste the code above into the console, and press Enter
on your keyboard to run the script.
OMG i just want to say THANK YOU !!!! this is so good :) Does anyone know how many likes does Instagram let you do before they ban you ? how long do you guys run this code for ?
dont have any auto follow ?
this should work, wrote it cuz I have noting better to do, dosnt press next button till its liked. also has a random interval between 1 second to 5 seconds so IG dosnt see it as a bot
var random = Math.random()*(5000-1000+1)+10;
var likes = 0;
function NB(){
//next button
var element = document.querySelector('svg[aria-label="Next"]')
if(typeof(element) != 'undefined' && element != null){
console.log('Element exists!');
document.querySelector('svg[aria-label="Next"]').parentElement.parentElement.click();
likes = likes + 1;
} else{
alert(`You Liked ${likes} likes post(s)`);
clearInterval(likeBtn);
}
}
var likeBtn = setInterval(like, random);
function like(){
//like button
var element = document.getElementsByClassName('QBdPU rrUvL')
if(typeof(element) != 'undefined' && element != null){
var classes = document.getElementsByClassName('QBdPU rrUvL');
var Rate = classes[0];
Rate.click();
setTimeout(function(){
NB();
}, random)
} else{
}
}
Unfortunately instagram added a like spam filter.
You need to set the timer higher then 5 seconds.
Here is my 2022 Working Script:
let likesGiven = 0;
setInterval(() => {
let heart = document.getElementsByClassName("fr66n")[0].getElementsByClassName("wpO6b")[0],
arrow = document.getElementsByClassName(" l8mY4 feth3")[0].getElementsByClassName("wpO6b")[0];
if (heart) {
likesGiven++;
heart.click();
}
arrow.click();
console.log('You've liked ${likesGiven} post(s)!');
}, 7500);
The last picture gets liked and unliked again and again. So the page has to be reloaded and the last like set manually. If someone likes to optimize the script so that it stops at the last frame after the like, feel free to do it and share it.
For those still looking for a properly working solution:
// Profile data
const profile = {
posts: parseInt(document.getElementsByClassName("g47SY")[0].textContent),
username: document.getElementsByClassName("_7UhW9")[0].textContent,
index: 0
}
// Check if user is on the correct page, if not, attempt to redirect to the correct page.
IG_Check = () => {
if (!profile.posts) return console.error("Error: Posts could not be found. Are you on the right page?");
if (!profile.username) return console.error("Error: Username could not be found. Are you on the right page?");
if (typeof profile.posts != "number") return console.error("Error: TotalPosts is not a number which means the class name has probably changed.");
if (profile.posts < 1) return console.warn("Warning: There are not posts to like.");
const _Location = window.location.href;
if (_Location.slice(_Location.length - 6 - profile.username.length) != `${profile.username}/feed/`) {
alert("This script is running on the incorrect page and will attempt to navigate to the correct page. You will need to reload this script.");
window.location.href = `https://www.instagram.com/${profile.username}/feed/`;
};
}
// Generates a random time above 7500
randomTime = () => {
console.time("Timeout");
return Math.random() * ((Math.random() * 5000) / Math.PI) + 7500;
}
// Prints user profile data
IG_PrintProfile = () => {
console.log(`Instagram Autoliker by @Lillious`);
console.log(`Username: ${profile.username}`);
console.log(`Total Posts: ${profile.posts}`);
}
// Autolike function
IG_AutoLike = () => {
setTimeout(() => {
if (profile.index >= profile.posts) return console.log("Finished auto liking.");
profile.index++;
window.scrollTo(0, document.body.scrollHeight);
let like = document.getElementsByClassName("fr66n")[profile.index].getElementsByClassName("wpO6b")[0];
if (like) {
like.click();
} else {
return console.error("Error: Like button could not be found.");
}
console.log(`Posts Liked: ${profile.index}/${profile.posts}`);
console.timeEnd("Timeout");
IG_AutoLike();
}, randomTime());
};
IG_Check();
IG_PrintProfile();
IG_AutoLike();
amazing broooo!
How can I activate the script. What exactly do i have to do?
How can I activate the script. What exactly do i have to do?
Pre-condition: using a Computer not a Mobile/Smart Phone.
Open you Dev Tool and paste it in the console there. You can open the Dev Tool in the most Browsers with F12 or CTRL + SHIFT + I or J. Not Sure about the last one. I use Opera GX as Browser.
In a instagram hashtag i click on a image and then I copied the code from devlillious in the console. But i get e error. 🤷🏼♂️
In a instagram hashtag i click on a image and then I copied the code from devlillious in the console. But i get e error. 🤷🏼♂️
Can you try mine? But I need to warn you. Thouse Auto Like Scripts are Forbidden and can cause a permanently ban from Instagram. So be careful by using them.
Instagram is constantly evolving to prevent botting and scripting. Does the classes and IDs of Instagram call each other again and again.
In a instagram hashtag i click on a image and then I copied the code from devlillious in the console. But i get e error. 🤷🏼♂️
I'm devlillious, just a new account for work.
My code most likely doesn't work anymore. It did at one point but like @PassCody stated, instagram is constantly evolving and changing their code.
Hello, I wrote some code you can use https://github.com/zone0119/instalike
let likes = 0;
let autoLike = setInterval(() => {
const heart = document.querySelector('svg[aria-label="Like"]');
const arrow = document.querySelector('svg[aria-label="Next"]');
if (heart) {
window.scrollTo(0, document.body.scrollHeight);
heart.parentNode.click();
likes++;
console.log(`You've liked ${likes} post(s)`);
}
if (arrow) {
arrow.parentElement.click();
}
}, Math.random()*(5000-1000+1)+10);
Doesn't the setTimeout() function only run once. So your code would run once after rand * 1000 ms instead of in intervals of rand * 1000 like it would with the setInterval() function.