Instagram Auto-Liker

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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!');
    }

})();