Skip to main content

Welcome to TikTokLive

TikTokLive is an unofficial Python API wrapper that lets you connect to any TikTok livestream and fetch all data available to users in a stream using just a creator’s @unique_id.
This is not a production-ready API. It is a reverse engineering project. For production use, consider the WebSocket API.

Key Features

Real-time Events

Receive comments, gifts, likes, follows, and 100+ other event types in real-time from TikTok LIVE streams

Async/Await Support

Built with asyncio for high-performance concurrent connections

Gift Handling

Advanced gift streak detection and handling for accurate gift counting

Proxy Support

Full HTTP and WebSocket proxy support for reliable connections

Quick Example

Here’s a minimal example to get you started:
from TikTokLive import TikTokLiveClient
from TikTokLive.events import ConnectEvent, CommentEvent

# Create the client
client: TikTokLiveClient = TikTokLiveClient(unique_id="@isaackogz")

# Listen to an event with a decorator
@client.on(ConnectEvent)
async def on_connect(event: ConnectEvent):
    print(f"Connected to @{event.unique_id} (Room ID: {client.room_id})")

# Add a listener manually
async def on_comment(event: CommentEvent) -> None:
    print(f"{event.user.nickname} -> {event.comment}")

client.add_listener(CommentEvent, on_comment)

if __name__ == '__main__':
    # Run the client and block the main thread
    client.run()

Get Started

Installation

Install TikTokLive via pip and set up your environment

Quickstart Guide

Build your first TikTok LIVE bot in minutes

Core Concepts

Learn about the client, events, and connection lifecycle

API Reference

Explore the complete API documentation

Community

Join the TikTokLive Discord and visit the #py-support channel for questions, contributions, and ideas.

Other Languages

TikTokLive is available in several other programming languages:

Build docs developers (and LLMs) love