parkpana-tiktok-scraper
v1.0.0
Published
TikTok Scraper & Downloader — scoped fork maintained by @parkpana. Scrape user/hashtag/trend/music feeds and download videos.
Maintainers
Readme
@parkpana/tiktok-scraper
TikTok Scraper & Downloader — modernised fork of tiktok-scraper maintained by @parkpana.
Supports Node.js 18+, uses got (instead of the deprecated request) and modern TypeScript 5.
Install
npm install @parkpana/tiktok-scraper
# or
yarn add @parkpana/tiktok-scraperQuick start (API)
const scraper = require('@parkpana/tiktok-scraper');
// Scrape user posts
const result = await scraper.user('tiktok', { number: 30 });
console.log(result.collector);
// Scrape hashtag
const posts = await scraper.hashtag('summer', { number: 50 });
// Download single video
await scraper.video('https://www.tiktok.com/@tiktok/video/1234567890', {
download: true,
filepath: './downloads',
});Event-based scraping
const users = scraper.userEvent('tiktok', { number: 30 });
users.on('data', json => console.log(json));
users.on('done', () => console.log('Done'));
users.on('error', err => console.error(err));
users.scrape();Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| number | number | 30 | Posts to scrape |
| download | boolean | false | Download video files |
| filepath | string | '' | Save path |
| filetype | 'json'\|'csv'\|'all' | '' | Output file format |
| proxy | string\|string[] | '' | HTTP or SOCKS proxy |
| sessionList | string[] | [] | TikTok session cookies (sid_tt=...) |
| noWaterMark | boolean | false | Remove watermark |
| asyncDownload | number | 5 | Concurrent downloads |
| timeout | number | 0 | Delay between requests (ms) |
CLI
npx @parkpana/tiktok-scraper user USERNAME -n 30 -t json
npx @parkpana/tiktok-scraper hashtag HASHTAG -n 50 -dChanges from original
request/request-promisereplaced withgot(v11, LTS compatible)json2csvreplaced with@json2csv/plainjs(v7)CookieJarmoved fromrequesttotough-cookie- TypeScript 5 +
ES2022target - Node.js 18+ minimum
- Scoped package:
@parkpana/tiktok-scraper
License
MIT
