Instagram Auto-Liker

Auto-likes Instagram posts and moves to the next one.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Instagram Auto-Liker
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Auto-likes Instagram posts and moves to the next one.
// @author       Yashwanth
// @match        *://www.instagram.com/*
// @grant        none
// @license        MIT
// ==/UserScript==

(function() {
    'use strict';

    console.log("🚀 Instagram Auto-Liker Script Loaded!");

    // Click on the first post
    const firstPost = document.querySelector('div._aagw');
    if (firstPost) {
        firstPost.click();
        console.log('✅ First post clicked.');

        // Start auto-liking process after a delay (ensuring the post opens)
        setTimeout(() => {
            let likes = 0;

            function likeAndNext() {
                const heart = document.querySelector('svg[aria-label="Like"][width="24"]');
                const arrow = document.querySelector('svg[aria-label="Next"]');

                if (heart) {
                    heart.parentNode.click(); // Click the like button
                    likes++;
                    console.log(`❤️ Liked ${likes} post(s).`);
                }

                if (arrow) {
                    setTimeout(() => {
                        arrow.parentElement.click(); // Click Next button
                        console.log('➡️ Moved to next post.');
                    }, 1000); // Delay before clicking "Next" to ensure smooth transition

                    setTimeout(likeAndNext, Math.random() * (5000 - 2000) + 2000); // Wait before liking the next post
                } else {
                    console.log("⛔ No more posts available. Stopping script.");
                }
            }

            setTimeout(likeAndNext, 2000); // Start process after initial delay

        }, 2000);
    } else {
        console.log('❌ No posts found!');
    }

})();