Skip to content

Instantly share code, notes, and snippets.

@amirofski
Last active May 17, 2023 11:03
Show Gist options
  • Save amirofski/d10ecb759800466c4e93589dc315d20f to your computer and use it in GitHub Desktop.
Save amirofski/d10ecb759800466c4e93589dc315d20f to your computer and use it in GitHub Desktop.
When you are on the web version of Instagram, you can run this code in the console to automatically like posts and scroll down and like and like and like and like until your account is banned. :)))
// Replace 'tags' with the desired hashtag
var hashtag = 'tags';
// Replace 'count' with the number of posts you want to like.so be careful . Do not increase these numbers. It was from us to say
var count = 10;
// Set the interval (in milliseconds) to scroll down the page
var scrollInterval = 10; // Adjust as needed
// Function to scroll down the page
function scrollPage() {
window.scrollTo(0, document.body.scrollHeight);
}
// Function to start liking posts
function startLikingPosts() {
// Get the list of posts by hashtag
var posts = document.querySelectorAll('article');
// Iterate over the posts and like them
for (var i = 0; i < posts.length && count > 0; i++) {
// Find the like button
var likeButton = posts[i].querySelector('button [aria-label="Like"]');
// Check if the button is already liked
var isLiked = likeButton && likeButton.getAttribute('aria-pressed') === 'true';
// If the button is found and not already liked, simulate a click event
if (likeButton && !isLiked) {
simulateClick(likeButton);
console.log('Liked post ' + (i + 1));
count--;
}
}
console.log('Liked ' + (10 - count) + ' posts.');
// Check if there are more posts to like
if (count > 0) {
// Scroll down the page
scrollPage();
// Wait for scrolling to finish, then continue liking posts
setTimeout(startLikingPosts, scrollInterval);
}
}
// Function to simulate a click event
function simulateClick(element) {
var event = new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
});
element.dispatchEvent(event);
}
// Start liking posts
startLikingPosts();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment