Puppeteer to sign into TikTok

Viewed 694

I am trying to use puppeteer to sign into TikTok. However, each time I try to sign into TikTok with puppeteer it says "You are visiting our site too frequently" as pictured below.

TikTok after running the code

Here are the things I've tried:

  • using puppeteer stealth
  • using firefox puppeteer
  • using both puppeteer stealth and firefox puppeteer
  • using a VPN
  • logging into the account on a different device, logging out on that device, and then running the code
  • waiting 4 hours between running the code

Puppeteer doesn't throw any errors either

Let me know what you guys think!

Here is the code too:

const puppeteer = require("puppeteer-extra");
const StealthPlugin = require("puppeteer-extra-plugin-stealth");
puppeteer.use(StealthPlugin());

(async () => {
  const browser = await puppeteer.launch({ headless: false });
  const page = await browser.newPage();
  await page.goto("https://www.tiktok.com/login/phone-or-email/email");
  await page.type("input[name=email]", EMAIL, { delay: 20 });
  await page.type("input[name=password]", PASSWORD, { delay: 20 }); // log in w email and password

  await page.evaluate(() => {
    document.querySelector("button[type=submit]").click();
  }); // press login button

  await page.screenshot({ path: "example.png" });

  await browser.close();
})();

1 Answers

Log in manually one time and then do a cookie injection for each subsequent login :)

(of course, you'll need to save down all the cookies to do so, but only once!)

Related