TikTok Live Auto Like and Comment

Automatically clicks the like button and comments "W" on TikTok Live every 45 seconds.

目前為 2024-11-04 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         TikTok Live Auto Like and Comment
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Automatically clicks the like button and comments "W" on TikTok Live every 45 seconds.
// @author       Loonyatom
// @match        *://*.tiktok.com/*/live
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    const totalClicks = 500; // Total number of likes to send
    const clickInterval = 50; // Interval between clicks in milliseconds
    const cooldownTime = 15000; // Cooldown time in milliseconds (15 seconds)
    const commentInterval = 45000; // Comment every 45 seconds

    let currentClicks = 0; // Track the number of likes clicked

    function clickLikeButton() {
        const likeButton = document.querySelector('.css-1if2uwl-DivLikeBtnIcon'); // Selector for the like button
        if (likeButton && currentClicks < totalClicks) {
            likeButton.click();
            currentClicks++;

            // Continue clicking until total clicks are reached
            setTimeout(clickLikeButton, clickInterval);
        } else if (currentClicks >= totalClicks) {
            console.log("Reached 500 likes, cooling down for 15 seconds...");
            setTimeout(() => {
                currentClicks = 0; // Reset click count after cooldown
                clickLikeButton(); // Start clicking again
            }, cooldownTime);
        } else {
            console.log("Like button not found.");
        }
    }

    function comment() {
        const chatInput = document.querySelector('div[contenteditable="plaintext-only"][placeholder="Say something nice"]'); // Selector for the chat input
        if (chatInput) {
            chatInput.textContent = "W"; // Set the chat input value to "W"
            chatInput.dispatchEvent(new Event('input', { bubbles: true })); // Trigger input event

            // Simulate pressing Enter to send the comment
            const enterEvent = new KeyboardEvent('keydown', {
                bubbles: true,
                cancelable: true,
                key: 'Enter',
                code: 'Enter'
            });
            chatInput.dispatchEvent(enterEvent);
        } else {
            console.log("Chat input not found.");
        }
    }

    function startLoop() {
        comment();
        setTimeout(startLoop, commentInterval); // Comment every 45 seconds
    }

    // Start the like button clicking and comment loops after a short delay to allow the page to load
    setTimeout(() => {
        clickLikeButton();
        startLoop();
    }, 5000); // Wait 5 seconds before starting
})();