tiktok like a video

tiktok like a video when you click on number 0, click again to remove it

作者
egycoder
今日安裝
0
安裝總數
5
評價
0 0 0
版本
2.0.1
建立日期
2025-06-18
更新日期
2025-06-18
尺寸
904 位元組
授權條款
MIT
腳本執行於

TikTok "Like a Video" UserScript – Documentation

TikTok "Like a Video" UserScript Documentation

🔍 What is this script?


This is a Tampermonkey user script that simplifies liking TikTok videos.
When you press the 0 key on your keyboard, it will programmatically click the
“Like” icon of the currently visible TikTok video.

✨ Key Features

  • Quickly like TikTok videos by pressing 0 on your keyboard.
  • Seamlessly integrates into TikTok's existing UI — you don't need to hunt for the like button.
  • Easy to disable or remove by simply turning off the script in Tampermonkey.

⚙️ How does it work?

  1. The script listens for the keydown event on the page.
  2. When you press the 0 key, it looks for all the action buttons displayed on the TikTok page.
  3. It filters those that have an aria-label containing the word "Like".
  4. It then simulates a click on the most recent like button, allowing you to like the video instantly.

📜 Script source code

// ==UserScript==
// @name         tiktok like a video
// @namespace    http://tampermonkey.net/
// @version      2.0.1
// @description  tiktok like a video when you click on number 0, click again to remove it
// @match        https://www.tiktok.com/
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    document.addEventListener('keydown', (event) => {
        if (event.key === '0') {
            const btns = document.querySelectorAll('.css-67yy18-ButtonActionItem.e1hk3hf90');
            const likes = [];
            for (const btn of btns) {
                if (btn.ariaLabel?.includes('Like')) {
                    likes.push(btn);
                }
            }
            likes.pop();
            likes.pop().click();
        }
    });
})();

🛠️ Usage

  • Install a userscript manager like Tampermonkey in your browser.
  • Copy the script into a new Tampermonkey script and enable it.
  • Visit https://www.tiktok.com/ and press the 0 key to like the currently displayed video.

💡 Notes & Limitations

  • This script is intended for desktop browsers with keyboard access.
  • It works as long as TikTok's layout and classes (.css-67yy18-ButtonActionItem.e1hk3hf90) remain the same. Any UI update might require an update to the script.


© 2024 egycoder — MIT License.