tiktok-scraper was the npm package for reading TikTok from Node.js. Its last release, 1.4.36, is from 2021. It needs a sid_tt session cookie from your browser, and it no longer gets past TikTok's request signatures: issue #663 reports "0 posts in collector", and to "Is this still working ?" in issue #824 the answer was "nope, this not work anymore".
This guide reads the same data with SocialTap in Node.js: a profile, an account's videos, a video's comments and a hashtag's videos.
What it took to run
TikTok signs every request its web app makes, and the signature changes. tiktok-scraper computed it with its own code and a session cookie:
import TikTokScraper from "tiktok-scraper";
const posts = await TikTokScraper.user("tiktok", {
number: 30,
sessionList: ["sid_tt=…"],
});
console.log(posts.collector);When TikTok changed its signatures, collector came back empty, and no release followed.
The same data with one API key
SocialTap reads TikTok for you and returns live data in one schema. We handle the proxies, blocks and platform changes. Install the SDK (ES modules, Node 20.3 or later):
npm install socialtapGet a key on the signup page and set it as SOCIALTAP_API_KEY. Every account starts with 100 free credits. This reads one profile:
// Save this as app.mjs (an ES module) and run: node app.mjs
import { SocialTap } from "socialtap";
const client = new SocialTap(); // apiKey defaults to process.env.SOCIALTAP_API_KEY
const res = await client.tiktok.profile.get({ handle: "nasa" });
console.log(res.data);
console.log(res.credits.charged, res.meta.request_id);Walk an account's videos
TikTokScraper.user() becomes client.tiktok.posts.iterate(), an async iterator over the account's videos, 15 a page, with two guards so a loop can't spend more than you meant:
// Save this as app.mjs (an ES module) and run: node app.mjs
import { SocialTap, APIError, NotFoundError, PrivateOrUnavailableError } from "socialtap";
const client = new SocialTap(); // apiKey defaults to process.env.SOCIALTAP_API_KEY
try {
// Stops at the end of the list, or at the first guard it reaches.
const items = client.tiktok.posts.iterate({ handle: "@khaby.lame" }, { maxPages: 10, maxCredits: 100 });
for await (const item of items) {
console.log(item);
}
console.log(items.pagesFetched, items.creditsCharged, items.stopReason, items.endReason);
} catch (err) {
if (err instanceof NotFoundError) {
// The item does not exist or was deleted.
console.error(err.code, err.remediation);
} else if (err instanceof PrivateOrUnavailableError) {
// The item exists but isn't public: it is private, age- or region-restricted, or needs a login.
console.error(err.code, err.remediation);
} else if (err instanceof APIError) {
// Retryable errors reach you only after the SDK's own retries. Failed requests cost no credits.
console.error(err.code, err.status, err.retryable, err.remediation, err.requestId);
} else throw err;
}Each video has its caption, hashtags, publish time, duration, thumbnail and its view, like, comment, share and save counts. TikTok rounds large counts on some pages, and approximate_fields names the rounded ones.
From tiktok-scraper to SocialTap
| tiktok-scraper | SocialTap | Endpoint |
|---|---|---|
TikTokScraper.getUserProfileInfo(name) | client.tiktok.profile.get() | TikTok Profile API |
TikTokScraper.user(name) | client.tiktok.posts.iterate() | TikTok Posts API |
TikTokScraper.getVideoMeta(url) | client.tiktok.post.get() | TikTok Post API |
TikTokScraper.hashtag(tag) | client.tiktok.hashtagPosts.iterate() | TikTok Hashtag Posts API |
download: true | client.tiktok.download.get() | TikTok Download API |
Comments, which tiktok-scraper didn't read, are client.tiktok.comments.iterate().
What it costs
You pay per successful request, and a list request returns a page:
- Videos of an account: $0.05–$0.13 per 1,000 posts.
- Comments: $0.01–$0.04 per 1,000 comments.
- Profiles: $0.75–$1.97 per 1,000 profiles.
Failed requests and cache hits cost nothing. See plans and packs.
Frequently asked questions
Does tiktok-scraper still work?
No. Its last release is from 2021, issues report empty results, and the maintainers haven't shipped a fix. TikTok's request signatures have changed several times since.
Do I need a TikTok session cookie?
No. SocialTap reads TikTok logged out with its own sessions and proxies. You send a handle, a video link or a hashtag with your SocialTap API key.
Can I download videos without the watermark?
Yes. The TikTok Download API returns watermark-free file links for a video or a photo post, with every rendition and its resolution.
Does it work on serverless platforms?
Yes. Each call is an HTTPS request with your key, with no browser and no native dependencies, so it runs on Vercel, Lambda or Cloudflare Workers.