Auto Like Tiktok: Github Fix [2021]
The Ultimate Guide to Fixing Auto-Like TikTok GitHub Scripts In the fast-paced world of social media automation, GitHub repositories for "TikTok Auto Like" scripts are notoriously short-lived. A script that functions perfectly one week might be completely defunct the next. If you are looking to "fix" a non-working auto-like bot you found on GitHub, you are likely facing one of several specific technical hurdles. This document outlines the architecture of modern TikTok automation, why old scripts fail, and the code logic required to fix them. Chapter 1: The Obsolescence of API-Based Bots Historically, most GitHub TikTok bots relied on Private API scraping . Developers reverse-engineered the endpoints used by the official TikTok mobile app to send HTTP requests directly. Why this method is broken (and hard to fix):
Signature Generation (SigCalc): TikTok has aggressively updated their security protocols. Every request sent to their internal API must be accompanied by a cryptographic signature (often generated via a native .so library or obfuscated JavaScript). GitHub projects often fail because the library generating these signatures becomes outdated, resulting in 403 Forbidden or 400 Bad Request errors. Device Registration: Modern TikTok security requires "registering" a device ID before interacting. Old scripts hardcode device IDs that have since been blacklisted. Captcha Challenges: API requests without a valid browser context now trigger Captchas that HTTP clients (like requests or axios ) cannot solve.
The Fix: Abandon pure API-based scripts. If the repository hasn't been updated in the last 3 months, the signature logic is likely irreparable without advanced reverse engineering. The modern standard is Browser Automation . Chapter 2: The Browser Automation Paradigm (Puppeteer & Selenium) To "fix" your auto-like script, you must rewrite it to control a real web browser (Chrome/Firefox). This mimics human behavior and bypasses many signature checks. The Setup (Node.js Example) Most modern, maintainable bots use Puppeteer with stealth plugins. If your script is failing on login or getting "Network Errors," ensure your setup includes anti-detection measures. const puppeteer = require('puppeteer-extra'); const StealthPlugin = require('puppeteer-extra-plugin-stealth'); puppeteer.use(StealthPlugin()); // Launch with specific args to avoid detection const browser = await puppeteer.launch({ headless: false, // Run headful to pass bot tests args: ['--start-maximized', '--disable-blink-features=AutomationControlled'] }); const page = await browser.newPage(); // Overwrite the navigator.webdriver property await page.evaluateOnNewDocument(() => { Object.defineProperty(navigator, 'webdriver', { get: () => false, }); });
Chapter 3: Common Failure Points and Fixes If you have a script that runs but fails to actually "Like" videos, here are the specific areas to debug. 1. XPath and Selectors TikTok frequently changes their CSS class names (often generated dynamically like div.tiktok-1y4xtrh ). Hardcoded selectors are the #1 cause of script failure. The Fix: Use robust selectors that rely on ARIA labels or stable attributes, rather than dynamic class names. auto like tiktok github fix
Old/Bad: await page.click('.like-button-container-3452') New/Fixed: // Look for the SVG aria-label which is usually stable const likeButton = await page.waitForSelector('span[data-e2e="like-icon"]', { timeout: 5000 }); await likeButton.click();
2. Scroll Handling and Lazy Loading A broken script often "likes" the same first three videos repeatedly or stops scrolling. This happens because the script scrolls faster than the DOM loads. The Fix: Implement a wait-for-selector loop inside a scroll function. async function autoScroll(page){ await page.evaluate(async () => { await new Promise((resolve) => { let totalHeight = 0; const distance = 100; const timer = setInterval(() => { const scrollHeight = document.body.scrollHeight; window.scrollBy(0, distance); totalHeight += distance; // Only scroll if content exists if(totalHeight >= scrollHeight - window.innerHeight){ clearInterval(timer); resolve(); } }, 100); // Slower scroll speed mimics humans }); });
}
3. Login State Persistence Many GitHub scripts ask you to log in every time. This triggers TikTok's risk engine. The Fix: Use localStorage or userDataDir to save your session cookies. const browser = await puppeteer.launch({ userDataDir: './user_data', // Saves session here headless: false }); // If cookies exist, you stay logged in, bypassing the login form entirely.
Chapter 4: The "Humanization" Fix (Avoiding Bans) If your script works technically but your account gets banned instantly, you need to "fix" the behavior, not the code. TikTok detects non-human patterns. Key Fixes for Longevity:
Randomized Delays: Never use sleep(2000) . Use a random range. const randomSleep = () => new Promise(r => setTimeout(r, Math.random() * 3000 + 1000)); The Ultimate Guide to Fixing Auto-Like TikTok GitHub
Mouse Movement: Puppeteer's page.click() jumps instantly to coordinates. Use a custom function to generate a curved mouse path. Libraries like puppeteer-mouse-stealth exist specifically to fix this. View Duration: Do not like a video instantly upon scrolling. A real user watches at least 3-5 seconds. Implement a timer that watches a percentage of the video length before executing the like action.
Chapter 5: Rate Limiting and Shadowbans Even a perfectly fixed script will encounter the "You are tapping too fast" error. The Logic Fix: You must implement a cooldown algorithm.