tiktok-live-api 1.3.1 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +38 -21
  3. package/package.json +84 -84
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 TikTool
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 TikTool
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -12,7 +12,6 @@
12
12
  [![npm downloads](https://img.shields.io/npm/dm/tiktok-live-api)](https://www.npmjs.com/package/tiktok-live-api)
13
13
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)](https://www.typescriptlang.org/)
14
14
  [![License](https://img.shields.io/npm/l/tiktok-live-api)](https://github.com/tiktool/tiktok-live-api/blob/main/LICENSE)
15
- [![Discord](https://img.shields.io/discord/1482387222912172159?logo=discord&label=Discord&color=5865F2)](https://discord.gg/y8TwuFBAmD)
16
15
 
17
16
  <p align="center">
18
17
  <img src="https://raw.githubusercontent.com/tiktool/tiktok-live-api/main/tiktok-live-api.gif" alt="TikTok Live API Demo — real-time chat, gifts, and viewer events" width="700">
@@ -67,14 +66,14 @@ That's it. **No complex setup, no protobuf, no reverse engineering, no breakages
67
66
 
68
67
  ---
69
68
 
70
- ## šŸš€ Try It Now — 5-Minute Live Demo
69
+ ## šŸš€ Try It Now — Live Demo
71
70
 
72
- Copy-paste this into a file and run it. Connects to a live TikTok stream, prints every event for 5 minutes, then exits. Works on the free Sandbox tier.
71
+ Copy-paste this into a file and run it. Connects to a live TikTok stream and prints every event in real time. Works on the free Community tier — no time limit, runs as long as the stream is live.
73
72
 
74
73
  **Save as `demo.mjs` and run with `node demo.mjs`:**
75
74
 
76
75
  ```javascript
77
- // demo.mjs — TikTok LIVE in 5 minutes
76
+ // demo.mjs — TikTok LIVE in real time
78
77
  // npm install tiktok-live-api
79
78
  import { TikTokLive } from 'tiktok-live-api';
80
79
 
@@ -91,11 +90,11 @@ client.on('member', e => { events++; console.log(`šŸ‘‹ ${e.user.uniqueId} j
91
90
  client.on('follow', e => { events++; console.log(`āž• ${e.user.uniqueId} followed`); });
92
91
  client.on('roomUserSeq', e => { events++; console.log(`šŸ‘€ Viewers: ${e.viewerCount}`); });
93
92
 
94
- client.on('connected', () => console.log(`\nāœ… Connected to @${LIVE_USERNAME} — listening for 5 min...\n`));
95
- client.on('disconnected', () => console.log(`\nšŸ“Š Done! Received ${events} events.\n`));
93
+ client.on('connected', () => console.log(`\nāœ… Connected to @${LIVE_USERNAME} — streaming events...\n`));
94
+ client.on('disconnected', () => console.log(`\nšŸ“Š Disconnected. Received ${events} events.\n`));
96
95
 
97
96
  client.connect();
98
- setTimeout(() => { client.disconnect(); }, 300_000);
97
+ // Press Ctrl+C to stop. Community tier has no per-connection time limit.
99
98
  ```
100
99
 
101
100
  <details>
@@ -112,7 +111,7 @@ const LIVE_USERNAME = 'tv_asahi_news';
112
111
  const ws = new WebSocket(`wss://api.tik.tools?uniqueId=${LIVE_USERNAME}&apiKey=${API_KEY}`);
113
112
  let events = 0;
114
113
 
115
- ws.on('open', () => console.log(`\nāœ… Connected to @${LIVE_USERNAME} — listening for 5 min...\n`));
114
+ ws.on('open', () => console.log(`\nāœ… Connected to @${LIVE_USERNAME} — streaming events...\n`));
116
115
  ws.on('message', (raw) => {
117
116
  const msg = JSON.parse(raw);
118
117
  events++;
@@ -128,9 +127,8 @@ ws.on('message', (raw) => {
128
127
  default: console.log(`šŸ“¦ ${msg.event}`); break;
129
128
  }
130
129
  });
131
- ws.on('close', () => console.log(`\nšŸ“Š Done! Received ${events} events.\n`));
132
-
133
- setTimeout(() => ws.close(), 300_000);
130
+ ws.on('close', () => console.log(`\nšŸ“Š Disconnected. Received ${events} events.\n`));
131
+ // Press Ctrl+C to stop. Community tier has no per-connection time limit.
134
132
  ```
135
133
 
136
134
  </details>
@@ -153,7 +151,7 @@ client.connect();
153
151
  2. Sign up (no credit card required)
154
152
  3. Copy your API key
155
153
 
156
- The free Sandbox tier gives you 50 requests/day and 1 WebSocket connection.
154
+ The free **Community** tier gives you 2,500 requests/day and 15 WebSocket connections with no per-connection time limit. Forever free.
157
155
 
158
156
  ## Environment Variable
159
157
 
@@ -373,24 +371,43 @@ client.on('gift', (event: GiftEvent) => {
373
371
  | **Maintenance** | āœ“ Zero — we handle it | āœ— You fix breakages | āœ— You fix breakages |
374
372
  | **CAPTCHA Solving** | āœ“ Built-in (Pro+) | āœ— | āœ— |
375
373
  | **Feed Discovery** | āœ“ See who's live | āœ— | āœ— |
376
- | **Free Tier** | āœ“ 50 requests/day | āœ“ Free (unreliable) | āœ“ Free (unreliable) |
374
+ | **Free Tier** | āœ“ 2,500 req/day, 15 WS, no time limit | āœ“ Free (unreliable) | āœ“ Free (unreliable) |
377
375
  | **ESM + CJS** | āœ“ Both supported | āœ“ | N/A |
378
376
 
379
377
  ## Pricing
380
378
 
381
379
  | Tier | Requests/Day | WebSocket Connections | Price |
382
380
  |------|-------------|----------------------|-------|
383
- | Sandbox | 50 | 1 (5 min) | Free |
384
- | Basic | 10,000 | 3 (8h) | $9/wk +tax |
385
- | Pro | 75,000 | 50 (8h) | $19/wk +tax |
386
- | Ultra | 300,000 | 250 (8h) | $58/wk +tax |
381
+ | Community | 2,500 | 15 (no time limit) | Free forever |
382
+ | Pro | 75,000 | 50 (8h) | from $59/mo +tax |
383
+ | Ultra | 300,000 | 250 (8h) | from $219/mo +tax |
384
+ | **Global Agency** | 300,000 | 500 (8h) + Firehose | $549/mo +tax |
387
385
 
388
386
  Full plan details at [tik.tools/pricing](https://tik.tools/pricing). Highlights:
389
387
 
390
- - **Sandbox** ($0): 50 req/day Ā· 1 WS (5 min limit) Ā· basic endpoints Ā· signatures included
391
- - **Basic** ($9/wk): 10K req/day Ā· 3 WS Ā· all endpoints Ā· 1 AI caption stream
392
- - **Pro** ($19/wk, **most popular**): 75K req/day Ā· 50 WS Ā· all endpoints Ā· 5 AI caption streams Ā· priority routing Ā· chat support
393
- - **Ultra** ($58/wk): 300K req/day Ā· 250 WS Ā· 20 AI caption streams Ā· **League Rankings API** (Ultra only) Ā· 99.5% uptime SLA Ā· priority chat support
388
+ - **Community** ($0 forever): 2,500 req/day Ā· 15 WS Ā· no time limit Ā· masked leaderboards. Designed for devs building apps — upgrade when you need real usernames. No datacenter proxies; calls must come from your own IP.
389
+ - **Pro** (monthly): 75K req/day Ā· 50 WS Ā· unmasked leaderboards Ā· CAPTCHA Solver Ā· Feed Discovery Ā· 5 AI caption streams Ā· priority routing Ā· chat support
390
+ - **Ultra** (monthly): 300K req/day Ā· 250 WS Ā· 20 AI caption streams Ā· **League Rankings API** unmasked Ā· 99.5% uptime SLA Ā· priority chat support
391
+ - **Global Agency** ($549/mo): Everything in Ultra + **Live Gifter Firehose WS** (region/league/global filters, min-diamond threshold) + VIP Telegram alerts + VIP Web Vault (unmasked historical visual access)
392
+
393
+ ### Live Gifter Firehose — Global Agency
394
+
395
+ Real-time gift event stream from our Dragonfly fan-out. Filter by region, league, or globally; cap by minimum diamond threshold. Mid-stream filter updates supported via `update_filter` frame, no reconnect needed.
396
+
397
+ ```js
398
+ const ws = new WebSocket(
399
+ `wss://api.tik.tools/firehose/gifters?apiKey=${KEY}&mode=region&region=US%2B&min_diamonds=1000`
400
+ )
401
+ ws.on('message', (raw) => {
402
+ const evt = JSON.parse(raw)
403
+ // evt: { type:'gifter_alert', ts, gifter:{username,displayName,isAnonymous},
404
+ // creator:{uniqueId}, gift:{name,totalDiamonds}, region }
405
+ })
406
+ // Update filter without reconnect
407
+ ws.send(JSON.stringify({ type: 'update_filter', mode: 'global', min_diamonds: 5000 }))
408
+ ```
409
+
410
+ Modes: `global` (all regions), `region` (single region code), `league` (region + league class, e.g. `B2`).
394
411
 
395
412
  ## Also Available
396
413
 
package/package.json CHANGED
@@ -1,84 +1,84 @@
1
- {
2
- "name": "tiktok-live-api",
3
- "version": "1.3.1",
4
- "description": "Unofficial TikTok LIVE API Client — Real-time chat, gifts, viewers, battles, and AI live captions from any TikTok livestream. Managed WebSocket API with 99.9% uptime.",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.js"
13
- }
14
- },
15
- "files": [
16
- "dist",
17
- "README.md",
18
- "LICENSE"
19
- ],
20
- "scripts": {
21
- "build": "tsup src/index.ts --format cjs,esm --dts --clean",
22
- "prepublishOnly": "npm run build"
23
- },
24
- "keywords": [
25
- "tiktok",
26
- "tiktok-live",
27
- "tiktok-api",
28
- "tiktok-live-api",
29
- "tiktok-live-connector",
30
- "tiktok-live-sdk",
31
- "tiktok-websocket",
32
- "tiktok-chat",
33
- "tiktok-gifts",
34
- "tiktok-bot",
35
- "tiktok-data",
36
- "tiktok-stream",
37
- "tiktok-events",
38
- "tiktok-viewer",
39
- "live-streaming",
40
- "live-chat",
41
- "webcast",
42
- "websocket",
43
- "real-time",
44
- "speech-to-text",
45
- "captions",
46
- "transcription",
47
- "translation",
48
- "tiktok-live-python",
49
- "tiktok-tools",
50
- "euler-stream",
51
- "tiktoklive",
52
- "tiktok-connector",
53
- "tiktok-live-node",
54
- "tiktok-live-js",
55
- "tiktok-scraper",
56
- "tiktok-monitoring",
57
- "livestream-api"
58
- ],
59
- "author": {
60
- "name": "TikTool",
61
- "email": "support@tik.tools",
62
- "url": "https://tik.tools"
63
- },
64
- "license": "MIT",
65
- "repository": {
66
- "type": "git",
67
- "url": "https://github.com/tiktool/tiktok-live-api"
68
- },
69
- "bugs": {
70
- "url": "https://github.com/tiktool/tiktok-live-api/issues"
71
- },
72
- "homepage": "https://tik.tools",
73
- "dependencies": {
74
- "ws": "^8.16.0"
75
- },
76
- "devDependencies": {
77
- "@types/ws": "^8.5.10",
78
- "tsup": "^8.0.0",
79
- "typescript": "^5.3.0"
80
- },
81
- "engines": {
82
- "node": ">=16.0.0"
83
- }
84
- }
1
+ {
2
+ "name": "tiktok-live-api",
3
+ "version": "1.4.1",
4
+ "description": "Unofficial TikTok LIVE API Client — Real-time chat, gifts, viewers, battles, and AI live captions from any TikTok livestream. Managed WebSocket API with 99.9% uptime.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean",
22
+ "prepublishOnly": "npm run build"
23
+ },
24
+ "keywords": [
25
+ "tiktok",
26
+ "tiktok-live",
27
+ "tiktok-api",
28
+ "tiktok-live-api",
29
+ "tiktok-live-connector",
30
+ "tiktok-live-sdk",
31
+ "tiktok-websocket",
32
+ "tiktok-chat",
33
+ "tiktok-gifts",
34
+ "tiktok-bot",
35
+ "tiktok-data",
36
+ "tiktok-stream",
37
+ "tiktok-events",
38
+ "tiktok-viewer",
39
+ "live-streaming",
40
+ "live-chat",
41
+ "webcast",
42
+ "websocket",
43
+ "real-time",
44
+ "speech-to-text",
45
+ "captions",
46
+ "transcription",
47
+ "translation",
48
+ "tiktok-live-python",
49
+ "tiktok-tools",
50
+ "euler-stream",
51
+ "tiktoklive",
52
+ "tiktok-connector",
53
+ "tiktok-live-node",
54
+ "tiktok-live-js",
55
+ "tiktok-scraper",
56
+ "tiktok-monitoring",
57
+ "livestream-api"
58
+ ],
59
+ "author": {
60
+ "name": "TikTool",
61
+ "email": "support@tik.tools",
62
+ "url": "https://tik.tools"
63
+ },
64
+ "license": "MIT",
65
+ "repository": {
66
+ "type": "git",
67
+ "url": "https://github.com/tiktool/tiktok-live-api"
68
+ },
69
+ "bugs": {
70
+ "url": "https://github.com/tiktool/tiktok-live-api/issues"
71
+ },
72
+ "homepage": "https://tik.tools",
73
+ "dependencies": {
74
+ "ws": "^8.16.0"
75
+ },
76
+ "devDependencies": {
77
+ "@types/ws": "^8.5.10",
78
+ "tsup": "^8.0.0",
79
+ "typescript": "^5.3.0"
80
+ },
81
+ "engines": {
82
+ "node": ">=16.0.0"
83
+ }
84
+ }