tiktok-live-api 1.2.0 → 1.2.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.
- package/README.md +435 -364
- package/package.json +84 -84
package/README.md
CHANGED
|
@@ -1,364 +1,435 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[ managed API.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/tiktok-live-api)
|
|
10
|
+
[](https://www.npmjs.com/package/tiktok-live-api)
|
|
11
|
+
[](https://www.typescriptlang.org/)
|
|
12
|
+
[](https://github.com/tiktool/tiktok-live-api/blob/main/LICENSE)
|
|
13
|
+
[](https://discord.gg/y8TwuFBAmD)
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<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">
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
> This package is **not affiliated with or endorsed by TikTok**. It connects to the [TikTool Live](https://tik.tools) managed API service — 99.9% uptime, no reverse engineering, no maintenance required. Also available for [Python](https://pypi.org/project/tiktok-live-api/) and [any language via WebSocket](https://tik.tools/docs).
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install tiktok-live-api
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# or with yarn / pnpm / bun
|
|
29
|
+
yarn add tiktok-live-api
|
|
30
|
+
pnpm add tiktok-live-api
|
|
31
|
+
bun add tiktok-live-api
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { TikTokLive } from 'tiktok-live-api';
|
|
38
|
+
|
|
39
|
+
const client = new TikTokLive('streamer_username', { apiKey: 'YOUR_API_KEY' });
|
|
40
|
+
|
|
41
|
+
client.on('chat', (event) => {
|
|
42
|
+
console.log(`${event.user.uniqueId}: ${event.comment}`);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
client.on('gift', (event) => {
|
|
46
|
+
console.log(`${event.user.uniqueId} sent ${event.giftName} (${event.diamondCount} 💎)`);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
client.on('like', (event) => {
|
|
50
|
+
console.log(`${event.user.uniqueId} liked (total: ${event.totalLikes})`);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
client.on('follow', (event) => {
|
|
54
|
+
console.log(`${event.user.uniqueId} followed!`);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
client.on('roomUserSeq', (event) => {
|
|
58
|
+
console.log(`${event.viewerCount} viewers watching`);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
client.connect();
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
That's it. **No complex setup, no protobuf, no reverse engineering, no breakages when TikTok updates.**
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 🚀 Try It Now — 5-Minute Live Demo
|
|
69
|
+
|
|
70
|
+
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
|
+
|
|
72
|
+
**Save as `demo.mjs` and run with `node demo.mjs`:**
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
// demo.mjs — TikTok LIVE in 5 minutes
|
|
76
|
+
// npm install tiktok-live-api
|
|
77
|
+
import { TikTokLive } from 'tiktok-live-api';
|
|
78
|
+
|
|
79
|
+
const API_KEY = 'YOUR_API_KEY'; // Get free key → https://tik.tools
|
|
80
|
+
const LIVE_USERNAME = 'tv_asahi_news'; // Any live TikTok username
|
|
81
|
+
|
|
82
|
+
const client = new TikTokLive(LIVE_USERNAME, { apiKey: API_KEY });
|
|
83
|
+
let events = 0;
|
|
84
|
+
|
|
85
|
+
client.on('chat', e => { events++; console.log(`💬 ${e.user.uniqueId}: ${e.comment}`); });
|
|
86
|
+
client.on('gift', e => { events++; console.log(`🎁 ${e.user.uniqueId} sent ${e.giftName} (${e.diamondCount}💎)`); });
|
|
87
|
+
client.on('like', e => { events++; console.log(`❤️ ${e.user.uniqueId} liked × ${e.likeCount}`); });
|
|
88
|
+
client.on('member', e => { events++; console.log(`👋 ${e.user.uniqueId} joined`); });
|
|
89
|
+
client.on('follow', e => { events++; console.log(`➕ ${e.user.uniqueId} followed`); });
|
|
90
|
+
client.on('roomUserSeq', e => { events++; console.log(`👀 Viewers: ${e.viewerCount}`); });
|
|
91
|
+
|
|
92
|
+
client.on('connected', () => console.log(`\n✅ Connected to @${LIVE_USERNAME} — listening for 5 min...\n`));
|
|
93
|
+
client.on('disconnected', () => console.log(`\n📊 Done! Received ${events} events.\n`));
|
|
94
|
+
|
|
95
|
+
client.connect();
|
|
96
|
+
setTimeout(() => { client.disconnect(); }, 300_000);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
<details>
|
|
100
|
+
<summary><strong>🔌 Pure WebSocket version (no SDK, any language)</strong></summary>
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
// ws-demo.mjs — Pure WebSocket, zero SDK
|
|
104
|
+
// npm install ws
|
|
105
|
+
import WebSocket from 'ws';
|
|
106
|
+
|
|
107
|
+
const API_KEY = 'YOUR_API_KEY';
|
|
108
|
+
const LIVE_USERNAME = 'tv_asahi_news';
|
|
109
|
+
|
|
110
|
+
const ws = new WebSocket(`wss://api.tik.tools?uniqueId=${LIVE_USERNAME}&apiKey=${API_KEY}`);
|
|
111
|
+
let events = 0;
|
|
112
|
+
|
|
113
|
+
ws.on('open', () => console.log(`\n✅ Connected to @${LIVE_USERNAME} — listening for 5 min...\n`));
|
|
114
|
+
ws.on('message', (raw) => {
|
|
115
|
+
const msg = JSON.parse(raw);
|
|
116
|
+
events++;
|
|
117
|
+
const d = msg.data || {};
|
|
118
|
+
const user = d.user?.uniqueId || '';
|
|
119
|
+
switch (msg.event) {
|
|
120
|
+
case 'chat': console.log(`💬 ${user}: ${d.comment}`); break;
|
|
121
|
+
case 'gift': console.log(`🎁 ${user} sent ${d.giftName} (${d.diamondCount}💎)`); break;
|
|
122
|
+
case 'like': console.log(`❤️ ${user} liked × ${d.likeCount}`); break;
|
|
123
|
+
case 'member': console.log(`👋 ${user} joined`); break;
|
|
124
|
+
case 'roomUserSeq': console.log(`👀 Viewers: ${d.viewerCount}`); break;
|
|
125
|
+
case 'roomInfo': console.log(`📡 Room: ${msg.roomId}`); break;
|
|
126
|
+
default: console.log(`📦 ${msg.event}`); break;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
ws.on('close', () => console.log(`\n📊 Done! Received ${events} events.\n`));
|
|
130
|
+
|
|
131
|
+
setTimeout(() => ws.close(), 300_000);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
</details>
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## JavaScript (CommonJS)
|
|
139
|
+
|
|
140
|
+
```javascript
|
|
141
|
+
const { TikTokLive } = require('tiktok-live-api');
|
|
142
|
+
|
|
143
|
+
const client = new TikTokLive('streamer_username', { apiKey: 'YOUR_API_KEY' });
|
|
144
|
+
client.on('chat', (e) => console.log(`${e.user.uniqueId}: ${e.comment}`));
|
|
145
|
+
client.connect();
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Get a Free API Key
|
|
149
|
+
|
|
150
|
+
1. Go to [tik.tools](https://tik.tools)
|
|
151
|
+
2. Sign up (no credit card required)
|
|
152
|
+
3. Copy your API key
|
|
153
|
+
|
|
154
|
+
The free Sandbox tier gives you 50 requests/day and 1 WebSocket connection.
|
|
155
|
+
|
|
156
|
+
## Environment Variable
|
|
157
|
+
|
|
158
|
+
Instead of passing `apiKey` directly, you can set it as an environment variable:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Linux / macOS
|
|
162
|
+
export TIKTOOL_API_KEY=your_api_key_here
|
|
163
|
+
|
|
164
|
+
# Windows (CMD)
|
|
165
|
+
set TIKTOOL_API_KEY=your_api_key_here
|
|
166
|
+
|
|
167
|
+
# Windows (PowerShell)
|
|
168
|
+
$env:TIKTOOL_API_KEY="your_api_key_here"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
import { TikTokLive } from 'tiktok-live-api';
|
|
173
|
+
|
|
174
|
+
// Automatically reads TIKTOOL_API_KEY from environment
|
|
175
|
+
const client = new TikTokLive('streamer_username');
|
|
176
|
+
client.on('chat', (e) => console.log(e.comment));
|
|
177
|
+
client.connect();
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Events
|
|
181
|
+
|
|
182
|
+
| Event | Description | Key Fields |
|
|
183
|
+
|-------|-------------|------------|
|
|
184
|
+
| `chat` | Chat message | `user`, `comment`, `emotes`, `starred?` |
|
|
185
|
+
| `gift` | Virtual gift | `user`, `giftName`, `diamondCount`, `repeatCount` |
|
|
186
|
+
| `like` | Like event | `user`, `likeCount`, `totalLikes` |
|
|
187
|
+
| `follow` | New follower | `user` |
|
|
188
|
+
| `share` | Stream share | `user` |
|
|
189
|
+
| `member` | Viewer joined | `user` |
|
|
190
|
+
| `subscribe` | New subscriber | `user` |
|
|
191
|
+
| `roomUserSeq` | Viewer count | `viewerCount`, `topViewers` |
|
|
192
|
+
| `battle` | Battle event | `type`, `teams`, `scores` |
|
|
193
|
+
| `roomPin` | Pinned/starred message | `user`, `comment`, `action`, `durationSeconds` |
|
|
194
|
+
| `envelope` | Treasure chest | `diamonds`, `user` |
|
|
195
|
+
| `streamEnd` | Stream ended | `reason` |
|
|
196
|
+
| `connected` | Connected | `uniqueId` |
|
|
197
|
+
| `disconnected` | Disconnected | `uniqueId` |
|
|
198
|
+
| `error` | Error occurred | `error` |
|
|
199
|
+
| `event` | Catch-all | Full raw event |
|
|
200
|
+
|
|
201
|
+
All events are fully typed with TypeScript interfaces. Your IDE will show autocompletion for every field.
|
|
202
|
+
|
|
203
|
+
## Live Captions (Speech-to-Text)
|
|
204
|
+
|
|
205
|
+
Transcribe and translate any TikTok LIVE stream in real-time. **This feature is unique to TikTool Live — no other TikTok library offers it.**
|
|
206
|
+
|
|
207
|
+
```typescript
|
|
208
|
+
import { TikTokCaptions } from 'tiktok-live-api';
|
|
209
|
+
|
|
210
|
+
<<<<<<< HEAD
|
|
211
|
+
live.on('event', (event) => {
|
|
212
|
+
console.log(event.type, event);
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Reference
|
|
217
|
+
|
|
218
|
+
| Event | Type | Description | Fields |
|
|
219
|
+
|-------|------|-------------|--------|
|
|
220
|
+
| `chat` | `ChatEvent` | Chat message | `user`, `comment`, `starred?` |
|
|
221
|
+
| `member` | `MemberEvent` | User joined | `user`, `action` |
|
|
222
|
+
| `like` | `LikeEvent` | User liked | `user`, `likeCount`, `totalLikes` |
|
|
223
|
+
| `gift` | `GiftEvent` | Gift sent | `user`, `giftName`, `diamondCount`, `repeatCount`, `combo` |
|
|
224
|
+
| `social` | `SocialEvent` | Follow / Share | `user`, `action` |
|
|
225
|
+
| `roomUserSeq` | `RoomUserSeqEvent` | Viewer count | `viewerCount`, `totalViewers` |
|
|
226
|
+
| `battle` | `BattleEvent` | Link Mic battle | `status` |
|
|
227
|
+
| `battleArmies` | `BattleArmiesEvent` | Battle teams | — |
|
|
228
|
+
| `subscribe` | `SubscribeEvent` | New subscriber | `user`, `subMonth` |
|
|
229
|
+
| `emoteChat` | `EmoteChatEvent` | Emote in chat | `user`, `emoteId` |
|
|
230
|
+
| `envelope` | `EnvelopeEvent` | Treasure chest | `diamondCount` |
|
|
231
|
+
| `question` | `QuestionEvent` | Q&A question | `user`, `questionText` |
|
|
232
|
+
| `control` | `ControlEvent` | Stream control | `action` (3 = ended) |
|
|
233
|
+
| `room` | `RoomEvent` | Room status | `status` |
|
|
234
|
+
| `liveIntro` | `LiveIntroEvent` | Stream intro | `title` |
|
|
235
|
+
| `rankUpdate` | `RankUpdateEvent` | Rank update | `rankType` |
|
|
236
|
+
| `linkMic` | `LinkMicEvent` | Link Mic | `action` |
|
|
237
|
+
| `roomPin` | `RoomPinEvent` | Pinned/starred message | `user`, `comment`, `action`, `durationSeconds` |
|
|
238
|
+
| `unknown` | `UnknownEvent` | Unrecognized | `method` |
|
|
239
|
+
|
|
240
|
+
### Connection Events
|
|
241
|
+
|
|
242
|
+
| Event | Callback | Description |
|
|
243
|
+
|-------|----------|-------------|
|
|
244
|
+
| `connected` | `() => void` | Connected to stream |
|
|
245
|
+
| `disconnected` | `(code, reason) => void` | Disconnected |
|
|
246
|
+
| `roomInfo` | `(info: RoomInfo) => void` | Room info |
|
|
247
|
+
| `error` | `(error: Error) => void` | Error |
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 🎤 Real-Time Live Captions
|
|
252
|
+
|
|
253
|
+
AI-powered speech-to-text transcription and translation for TikTok LIVE streams. Features include:
|
|
254
|
+
|
|
255
|
+
- **Auto-detect language** — Automatically identifies the spoken language
|
|
256
|
+
- **Speaker diarization** — Identifies individual speakers in multi-person streams
|
|
257
|
+
- **Real-time translation** — Translate to any supported language with sub-second latency
|
|
258
|
+
- **Partial + final results** — Get streaming partial transcripts and confirmed final text
|
|
259
|
+
- **Credit-based billing** — 1 credit = 1 minute of transcription/translation
|
|
260
|
+
|
|
261
|
+
### Quick Start
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
import { TikTokCaptions } from '@tiktool/live';
|
|
265
|
+
|
|
266
|
+
const captions = new TikTokCaptions({
|
|
267
|
+
uniqueId: 'streamer_name',
|
|
268
|
+
apiKey: 'YOUR_API_KEY',
|
|
269
|
+
translate: 'en',
|
|
270
|
+
diarization: true,
|
|
271
|
+
=======
|
|
272
|
+
const captions = new TikTokCaptions('streamer_username', {
|
|
273
|
+
apiKey: 'YOUR_API_KEY',
|
|
274
|
+
translate: 'en', // translate to English
|
|
275
|
+
diarization: true, // identify who is speaking
|
|
276
|
+
>>>>>>> ac7990ac0be77c4206d9d8fa0bccbe1c85a2bbe6
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
captions.on('caption', (event) => {
|
|
280
|
+
const speaker = event.speaker ? `[${event.speaker}] ` : '';
|
|
281
|
+
console.log(`${speaker}${event.text}${event.isFinal ? ' ✓' : '...'}`);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
captions.on('translation', (event) => {
|
|
285
|
+
console.log(` → ${event.text}`);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
captions.on('credits', (event) => {
|
|
289
|
+
console.log(`${event.remaining}/${event.total} minutes remaining`);
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
captions.connect();
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Caption Events
|
|
296
|
+
|
|
297
|
+
| Event | Description | Key Fields |
|
|
298
|
+
|-------|-------------|------------|
|
|
299
|
+
| `caption` | Real-time caption text | `text`, `speaker`, `isFinal`, `language` |
|
|
300
|
+
| `translation` | Translated caption | `text`, `sourceLanguage`, `targetLanguage` |
|
|
301
|
+
| `credits` | Credit balance update | `total`, `used`, `remaining` |
|
|
302
|
+
| `credits_low` | Low credit warning | `remaining`, `percentage` |
|
|
303
|
+
| `status` | Session status | `status`, `message` |
|
|
304
|
+
|
|
305
|
+
## Chat Bot Example
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
import { TikTokLive } from 'tiktok-live-api';
|
|
309
|
+
|
|
310
|
+
const client = new TikTokLive('streamer_username', { apiKey: 'YOUR_API_KEY' });
|
|
311
|
+
const giftLeaderboard = new Map<string, number>();
|
|
312
|
+
let messageCount = 0;
|
|
313
|
+
|
|
314
|
+
client.on('chat', (event) => {
|
|
315
|
+
messageCount++;
|
|
316
|
+
const msg = event.comment.toLowerCase().trim();
|
|
317
|
+
const user = event.user.uniqueId;
|
|
318
|
+
|
|
319
|
+
if (msg === '!hello') {
|
|
320
|
+
console.log(`>> BOT: Welcome ${user}! 👋`);
|
|
321
|
+
} else if (msg === '!stats') {
|
|
322
|
+
console.log(`>> BOT: ${messageCount} messages, ${giftLeaderboard.size} gifters`);
|
|
323
|
+
} else if (msg === '!top') {
|
|
324
|
+
const top = [...giftLeaderboard.entries()]
|
|
325
|
+
.sort((a, b) => b[1] - a[1])
|
|
326
|
+
.slice(0, 5);
|
|
327
|
+
top.forEach(([name, diamonds], i) => {
|
|
328
|
+
console.log(` ${i + 1}. ${name} — ${diamonds} 💎`);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
client.on('gift', (event) => {
|
|
334
|
+
const user = event.user.uniqueId;
|
|
335
|
+
const diamonds = event.diamondCount || 0;
|
|
336
|
+
giftLeaderboard.set(user, (giftLeaderboard.get(user) || 0) + diamonds);
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
client.connect();
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## TypeScript
|
|
343
|
+
|
|
344
|
+
This package ships with full TypeScript support. All events are typed:
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
import { TikTokLive, ChatEvent, GiftEvent } from 'tiktok-live-api';
|
|
348
|
+
|
|
349
|
+
const client = new TikTokLive('streamer', { apiKey: 'KEY' });
|
|
350
|
+
|
|
351
|
+
// Full autocompletion — your IDE knows the type of `event`
|
|
352
|
+
client.on('chat', (event: ChatEvent) => {
|
|
353
|
+
console.log(event.user.uniqueId); // ✓ typed
|
|
354
|
+
console.log(event.comment); // ✓ typed
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
client.on('gift', (event: GiftEvent) => {
|
|
358
|
+
console.log(event.giftName); // ✓ typed
|
|
359
|
+
console.log(event.diamondCount); // ✓ typed
|
|
360
|
+
});
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## API Reference
|
|
364
|
+
|
|
365
|
+
### `new TikTokLive(uniqueId, options?)`
|
|
366
|
+
|
|
367
|
+
| Option | Type | Default | Description |
|
|
368
|
+
|--------|------|---------|-------------|
|
|
369
|
+
| `apiKey` | `string` | `process.env.TIKTOOL_API_KEY` | Your TikTool API key |
|
|
370
|
+
| `autoReconnect` | `boolean` | `true` | Auto-reconnect on disconnect |
|
|
371
|
+
| `maxReconnectAttempts` | `number` | `5` | Max reconnection attempts |
|
|
372
|
+
|
|
373
|
+
**Methods:**
|
|
374
|
+
- `client.on(event, handler)` — Register event handler
|
|
375
|
+
- `client.off(event, handler)` — Remove event handler
|
|
376
|
+
- `client.connect()` — Connect to stream (returns Promise)
|
|
377
|
+
- `client.disconnect()` — Disconnect from stream
|
|
378
|
+
- `client.connected` — Whether currently connected
|
|
379
|
+
- `client.eventCount` — Total events received
|
|
380
|
+
|
|
381
|
+
### `new TikTokCaptions(uniqueId, options?)`
|
|
382
|
+
|
|
383
|
+
| Option | Type | Default | Description |
|
|
384
|
+
|--------|------|---------|-------------|
|
|
385
|
+
| `apiKey` | `string` | `process.env.TIKTOOL_API_KEY` | Your TikTool API key |
|
|
386
|
+
| `translate` | `string` | `undefined` | Target translation language |
|
|
387
|
+
| `diarization` | `boolean` | `true` | Enable speaker identification |
|
|
388
|
+
| `maxDurationMinutes` | `number` | `60` | Auto-disconnect timer |
|
|
389
|
+
|
|
390
|
+
**Methods:**
|
|
391
|
+
- `captions.on(event, handler)` — Register event handler
|
|
392
|
+
- `captions.off(event, handler)` — Remove event handler
|
|
393
|
+
- `captions.connect()` — Start receiving captions (returns Promise)
|
|
394
|
+
- `captions.disconnect()` — Stop receiving captions
|
|
395
|
+
- `captions.connected` — Whether currently connected
|
|
396
|
+
|
|
397
|
+
## Why tiktok-live-api?
|
|
398
|
+
|
|
399
|
+
| | tiktok-live-api | tiktok-live-connector | TikTokLive (Python) |
|
|
400
|
+
|---|---|---|---|
|
|
401
|
+
| **Stability** | ✓ Managed API, 99.9% uptime | ✗ Breaks on TikTok updates | ✗ Breaks on TikTok updates |
|
|
402
|
+
| **TypeScript** | ✓ First-class, fully typed | Partial | N/A |
|
|
403
|
+
| **Live Captions** | ✓ AI speech-to-text | ✗ | ✗ |
|
|
404
|
+
| **Translation** | ✓ Real-time, 50+ languages | ✗ | ✗ |
|
|
405
|
+
| **Maintenance** | ✓ Zero — we handle it | ✗ You fix breakages | ✗ You fix breakages |
|
|
406
|
+
| **CAPTCHA Solving** | ✓ Built-in (Pro+) | ✗ | ✗ |
|
|
407
|
+
| **Feed Discovery** | ✓ See who's live | ✗ | ✗ |
|
|
408
|
+
| **Free Tier** | ✓ 50 requests/day | ✓ Free (unreliable) | ✓ Free (unreliable) |
|
|
409
|
+
| **ESM + CJS** | ✓ Both supported | ✓ | N/A |
|
|
410
|
+
|
|
411
|
+
## Pricing
|
|
412
|
+
|
|
413
|
+
| Tier | Requests/Day | WebSocket Connections | Price |
|
|
414
|
+
|------|-------------|----------------------|-------|
|
|
415
|
+
| Sandbox | 50 | 1 (5 min) | Free |
|
|
416
|
+
| Basic | 10,000 | 3 (8h) | $7/week |
|
|
417
|
+
| Pro | 75,000 | 50 (8h) | $15/week |
|
|
418
|
+
| Ultra | 300,000 | 500 (8h) | $45/week |
|
|
419
|
+
|
|
420
|
+
## Also Available
|
|
421
|
+
|
|
422
|
+
- **Python**: [`pip install tiktok-live-api`](https://pypi.org/project/tiktok-live-api/)
|
|
423
|
+
- **Any language**: Connect via WebSocket: `wss://api.tik.tools?uniqueId=USERNAME&apiKey=KEY`
|
|
424
|
+
- **Unreal Engine**: Native C++/Blueprint plugin
|
|
425
|
+
|
|
426
|
+
## Links
|
|
427
|
+
|
|
428
|
+
- 🌐 **Website**: [tik.tools](https://tik.tools)
|
|
429
|
+
- 📖 **Documentation**: [tik.tools/docs](https://tik.tools/docs)
|
|
430
|
+
- 🐍 **Python SDK**: [pypi.org/project/tiktok-live-api](https://pypi.org/project/tiktok-live-api/)
|
|
431
|
+
- 💻 **GitHub**: [github.com/tiktool/tiktok-live-api](https://github.com/tiktool/tiktok-live-api)
|
|
432
|
+
|
|
433
|
+
## License
|
|
434
|
+
|
|
435
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tiktok-live-api",
|
|
3
|
-
"version": "1.2.
|
|
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.2.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
|
+
}
|