atharahmed/tiktok-private-api

user.info returns null

Opened this issue · 2 comments

just tried the example code and it returns null for any user

Are you using this package with proxies?

Also, since TikTok doesn't work well with old versions of chrome try the following:

import { TikTokClient } from "tiktok-private-api";

(async () => {
  const scraper = new TikTokClient();

  // update user agent
  scraper.state.defaultHeaders = {
    ...scraper.state.defaultHeaders,
    "user-agent":
      "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
    "sec-ch-ua":
      '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"',
  };

  const data = await scraper.user.info("redbull");

  console.log(data);
})();

You might still get occasional empty results though