API reference generated from the docstrings and signatures of TikTokLive 7.0.1.
Modules
Section titled “Modules”TikTokLiveTikTokLive.clientTikTokLive.client.clientTikTokLive.client.errorsTikTokLive.client.loggerTikTokLive.client.webTikTokLive.client.web.routesTikTokLive.client.web.routes.fetch_gift_listTikTokLive.client.web.routes.fetch_image_dataTikTokLive.client.web.routes.fetch_is_liveTikTokLive.client.web.routes.fetch_room_id_apiTikTokLive.client.web.routes.fetch_room_id_live_htmlTikTokLive.client.web.routes.fetch_room_infoTikTokLive.client.web.routes.fetch_signed_websocketTikTokLive.client.web.routes.fetch_user_unique_idTikTokLive.client.web.routes.fetch_video_dataTikTokLive.client.web.routes.send_room_chatTikTokLive.client.web.web_baseTikTokLive.client.web.web_clientTikTokLive.client.web.web_presetsTikTokLive.client.web.web_settingsTikTokLive.client.web.web_signer— API Url for euler sign servicesTikTokLive.client.web.web_utilsTikTokLive.client.wsTikTokLive.client.ws.ws_clientTikTokLive.client.ws.ws_connectTikTokLive.client.ws.ws_utilsTikTokLive.eventsTikTokLive.events.base_eventTikTokLive.events.custom_eventsTikTokLive.events.proto_eventsTikTokLive.proto.custom_proto
Classes
Section titled “Classes”AccessControlEvent(TikTokLive.events.proto_events) — AccessControlEvent.AccessRecallEvent(TikTokLive.events.proto_events) — AccessRecallEvent.AgeRestrictedError(TikTokLive.client.errors) — Thrown when a LIVE is age restricted. Pass sessionid to bypass.AlreadyConnectedError(TikTokLive.client.errors) — Thrown when attempting to connect to a user that is already connected toAuthenticatedWebSocketConnectionError(TikTokLive.client.errors) — Thrown when sending the session ID to the sign server as this is deemed a risky operation that could lead to an account being banned.BarrageEvent(TikTokLive.events.proto_events) — BarrageEvent.BaseEvent(TikTokLive.events.base_event) — Base event emitted from the TikTokLiveClientBoostCardEvent(TikTokLive.events.proto_events) — BoostCardEvent.BottomEvent(TikTokLive.events.proto_events) — BottomEvent.CapsuleEvent(TikTokLive.events.proto_events) — CapsuleEvent.CaptionEvent(TikTokLive.events.proto_events) — CaptionEvent.ClientRoute(TikTokLive.client.web.web_base) — Base class for callable API routes. Provides dependency injection of the sharedTikTokHTTPClientand a logger; each subclass defines its own__call__signature with concrete parameter and return types.CommentEvent(TikTokLive.events.proto_events) — CommentEvent.ConnectEvent(TikTokLive.events.custom_events) — Manually thrown when the first payload is received from the Sign ServerControlEvent(TikTokLive.events.proto_events) — ControlEvent.DevicePreset(TikTokLive.client.web.web_presets)DisconnectEvent(TikTokLive.events.custom_events) — Thrown when disconnecting from a streamDuplicateDownloadError(TikTokLive.client.web.routes.fetch_video_data) — Thrown when attempting to start a duplicate download on a video you are already downloadingEmoteChatEvent(TikTokLive.events.proto_events) — EmoteChatEvent.EnvelopeEvent(TikTokLive.events.proto_events) — EnvelopeEvent.ExtendedGift(TikTokLive.proto.custom_proto) — Extended gift object with clearer streak handlingExtendedUser(TikTokLive.proto.custom_proto) — Extended user object with backwards compatibilityFailedFetchGiftListError(TikTokLive.client.web.routes.fetch_gift_list) — Thrown when a request to the gift list endpoint failsFailedFetchRoomInfoError(TikTokLive.client.web.routes.fetch_room_info) — Thrown if Room info request failsFailedParseAppInfo(TikTokLive.client.web.routes.fetch_user_unique_id) — Thrown when the App Info cannot be parsedFailedParseRoomIdError(TikTokLive.client.web.routes.fetch_room_id_live_html) — Thrown when the Room ID cannot be parsedFailedResolveUserId(TikTokLive.client.web.routes.fetch_user_unique_id) — Thrown when the User ID cant be resolvedFetchGifListRoute(TikTokLive.client.web.routes.fetch_gift_list) — Retrieve the gift list from TikTokFetchImageDataRoute(TikTokLive.client.web.routes.fetch_image_data) — Fetch an image from the TikTok CDNFetchIsLiveRoute(TikTokLive.client.web.routes.fetch_is_live) — Check if a given user is alive through their unique_id or room_idFetchRoomIdAPIRoute(TikTokLive.client.web.routes.fetch_room_id_api) — Route to retrieve the room ID for a userFetchRoomIdLiveHTMLRoute(TikTokLive.client.web.routes.fetch_room_id_live_html) — Route to retrieve the room ID for a userFetchRoomInfoRoute(TikTokLive.client.web.routes.fetch_room_info) — Retrieve the room info payload of a livestream roomFetchSignedWebSocketRoute(TikTokLive.client.web.routes.fetch_signed_websocket) — Call the signature server to receive the TikTok websocket URLFetchUserUniqueIdRoute(TikTokLive.client.web.routes.fetch_user_unique_id) — Route to retrieve the room ID for a userFetchVideoDataRoute(TikTokLive.client.web.routes.fetch_video_data) — TikTok route to record the livestream video in real-timeFollowEvent(TikTokLive.events.custom_events) — A SocialEvent, but we give it its own class for clarity’s sake.GameRankNotifyEvent(TikTokLive.events.proto_events) — GameRankNotifyEvent.GiftBroadcastEvent(TikTokLive.events.proto_events) — GiftBroadcastEvent.GiftDynamicRestrictionEvent(TikTokLive.events.proto_events) — GiftDynamicRestrictionEvent.GiftEvent(TikTokLive.events.proto_events) — GiftEvent.GiftPanelUpdateEvent(TikTokLive.events.proto_events) — GiftPanelUpdateEvent.GiftPromptEvent(TikTokLive.events.proto_events) — GiftPromptEvent.GoalUpdateEvent(TikTokLive.events.proto_events) — GoalUpdateEvent.GuideEvent(TikTokLive.events.proto_events) — GuideEvent.HourlyRankRewardEvent(TikTokLive.events.proto_events) — HourlyRankRewardEvent.ImDeleteEvent(TikTokLive.events.proto_events) — ImDeleteEvent.InitialCursorMissingError(TikTokLive.client.errors) — Thrown when the cursor for connecting to TikTok is missing (blocked)InRoomBannerEvent(TikTokLive.events.proto_events) — InRoomBannerEvent.InvalidFetchIsLiveRequest(TikTokLive.client.web.routes.fetch_is_live) — Thrown when the user fails to specify either a room ID or unique IDInvalidFetchRoomInfoPayload(TikTokLive.client.web.routes.fetch_room_info)JoinEvent(TikTokLive.events.proto_events) — JoinEvent.LikeEvent(TikTokLive.events.proto_events) — LikeEvent.LinkEvent(TikTokLive.events.proto_events) — LinkEvent.LinkLayerEvent(TikTokLive.events.proto_events) — LinkLayerEvent.LinkMicArmiesEvent(TikTokLive.events.proto_events) — LinkMicArmiesEvent.LinkMicBattleEvent(TikTokLive.events.proto_events) — LinkMicBattleEvent.LinkMicBattleItemCardEvent(TikTokLive.events.proto_events) — LinkMicBattleItemCardEvent.LinkMicBattlePunishFinishEvent(TikTokLive.events.proto_events) — LinkMicBattlePunishFinishEvent.LinkmicBattleTaskEvent(TikTokLive.events.proto_events) — LinkmicBattleTaskEvent.LinkMicFanTicketMethodEvent(TikTokLive.events.proto_events) — LinkMicFanTicketMethodEvent.LinkMicLayoutStateEvent(TikTokLive.events.proto_events) — LinkMicLayoutStateEvent.LinkMicMethodEvent(TikTokLive.events.proto_events) — LinkMicMethodEvent.LinkStateEvent(TikTokLive.events.proto_events) — LinkStateEvent.LiveEndEvent(TikTokLive.events.custom_events) — Thrown when the stream endsLiveGameIntroEvent(TikTokLive.events.proto_events) — LiveGameIntroEvent.LiveIntroEvent(TikTokLive.events.proto_events) — LiveIntroEvent.LivePauseEvent(TikTokLive.events.custom_events) — Thrown when the stream is pausedLiveUnpauseEvent(TikTokLive.events.custom_events) — Thrown when a paused stream is unpausedLocationPreset(TikTokLive.client.web.web_presets) — en style ISO codeLogLevel(TikTokLive.client.logger) — The level to be used with the python logging moduleMarqueeAnnouncementEvent(TikTokLive.events.proto_events) — MarqueeAnnouncementEvent.MessageDetectEvent(TikTokLive.events.proto_events) — MessageDetectEvent.MissingRoomIdInResponse(TikTokLive.client.web.routes.fetch_is_live) — Thrown when no entries are returned from the Room ID live method. This occurs when passing a nonexistent Room ID or when being detected by TikTok.NoticeEvent(TikTokLive.events.proto_events) — NoticeEvent.OecLiveShoppingEvent(TikTokLive.events.proto_events) — OecLiveShoppingEvent.PartnershipDropsUpdateEvent(TikTokLive.events.proto_events) — PartnershipDropsUpdateEvent.PartnershipGameOfflineEvent(TikTokLive.events.proto_events) — PartnershipGameOfflineEvent.PartnershipPunishEvent(TikTokLive.events.proto_events) — PartnershipPunishEvent.PerceptionEvent(TikTokLive.events.proto_events) — PerceptionEvent.PollEvent(TikTokLive.events.proto_events) — PollEvent.PremiumEndpointError(TikTokLive.client.errors)QuestionNewEvent(TikTokLive.events.proto_events) — QuestionNewEvent.RankTextEvent(TikTokLive.events.proto_events) — RankTextEvent.RankUpdateEvent(TikTokLive.events.proto_events) — RankUpdateEvent.RoomEvent(TikTokLive.events.proto_events) — RoomEvent.RoomNotifyEvent(TikTokLive.events.proto_events) — RoomNotifyEvent.RoomPinEvent(TikTokLive.events.proto_events) — RoomPinEvent.RoomUserSeqEvent(TikTokLive.events.proto_events) — RoomUserSeqEvent.RoomVerifyEvent(TikTokLive.events.proto_events) — RoomVerifyEvent.ScreenPreset(TikTokLive.client.web.web_presets)SendRoomChatRoute(TikTokLive.client.web.routes.send_room_chat)ShareEvent(TikTokLive.events.custom_events) — A SocialEvent, but we give it its own class for clarity’s sake.SignAPIError(TikTokLive.client.errors) — Thrown when a fetch to the Sign API fails for one reason or anotherSignatureMissingTokensError(TikTokLive.client.errors)SignatureRateLimitError(TikTokLive.client.errors) — Thrown when a user hits the Sign API limitSocialEvent(TikTokLive.events.proto_events) — SocialEvent.SpeakerEvent(TikTokLive.events.proto_events) — SpeakerEvent.SubNotifyEvent(TikTokLive.events.proto_events) — SubNotifyEvent.SubPinEventEvent(TikTokLive.events.proto_events) — SubPinEventEvent.SuperFanBoxEvent(TikTokLive.events.custom_events) — Emitted when a super-fan envelope (gift box) is delivered.SuperFanEvent(TikTokLive.events.custom_events) — Emitted when a viewer becomes a super fan of the streamer.SuperFanJoinEvent(TikTokLive.events.custom_events) — Emitted when an existing super fan joins the live (distinct fromSuperFanEventwhich fires when a viewer first becomes a super fan).SystemEvent(TikTokLive.events.proto_events) — SystemEvent.TikTokHTTPClient(TikTokLive.client.web.web_base) — HTTP client for interacting with the various APIsTikTokLiveClient(TikTokLive.client.client) — A client to connect to & read from TikTok LIVE streamsTikTokLiveError(TikTokLive.client.errors) — Base error class for TikTokLive errorsTikTokLiveLogHandler(TikTokLive.client.logger) — A custom logger handler for TikTokLiveTikTokSigner(TikTokLive.client.web.web_signer) — Utility to sign any TikTok request using Euler StreamTikTokWebClient(TikTokLive.client.web.web_client) — Wrapper for the HTTP client to add web routesToastEvent(TikTokLive.events.proto_events) — ToastEvent.UnauthorizedMemberEvent(TikTokLive.events.proto_events) — UnauthorizedMemberEvent.UnexpectedSignatureError(TikTokLive.client.errors)UnknownEvent(TikTokLive.events.custom_events) — Triggered when a Webcast message is received that is NOT tracked by TikTokLive yet.UserNotFoundError(TikTokLive.client.errors) — Thrown when the request to check if a user is live fails because a user has no livestream account (e.g. <1000 followers)UserOfflineError(TikTokLive.client.errors) — Thrown when the requested streamer to watch is offlineVideoFetchFormat(TikTokLive.client.web.routes.fetch_video_data) — TikTok-supported video recording formatsVideoFetchQuality(TikTokLive.client.web.routes.fetch_video_data) — Video quality selection for stream downloadsViewerPicksUpdateEvent(TikTokLive.events.proto_events) — ViewerPicksUpdateEvent.WebcastBlockedError(TikTokLive.client.errors) — Thrown when the webcast is blocked by TikTok with a 200 or 400 status code (detected)WebcastConnect(TikTokLive.client.ws.ws_connect)WebcastPlatform(TikTokLive.client.web.routes.fetch_signed_websocket) — Enum for the platform to request the WebSocket URL forWebcastProxyConnect(TikTokLive.client.ws.ws_connect) — Add Proxy support to the WebcastConnect classWebcastWSClient(TikTokLive.client.ws.ws_client) — Websocket client responsible for connections to TikTokWebsocketResponseEvent(TikTokLive.events.custom_events) — Triggered when any event is received from the WebSocket. Carries the rawProtoMessageFetchResultenvelope this event was extracted from onself.rawfor callers that want to inspect the underlying response fields (cursor, fetch_interval, ws_params, etc.).WebsocketURLMissingError(TikTokLive.client.errors) — Thrown when the websocket URL to connect to TikTok is missing (blocked)
Functions
Section titled “Functions”build_webcast_uri(TikTokLive.client.ws.ws_utils) — Build a webcast URI from a base URI and parameters. This method will format the base URI with the parameters and return the formatted URI.check_authenticated_session(TikTokLive.client.web.web_utils) — Check if the session ID is set and if the target IDC is set when using a session ID.extract_webcast_push_frame(TikTokLive.client.ws.ws_utils) — Extract a WebcastPushFrame from a raw byte payload. This method will parse the payload and return a WebcastPushFrame object. This method is useful for extracting push frames from a WebSocket connection.extract_webcast_response_message(TikTokLive.client.ws.ws_utils) — Extract the ProtoMessageFetchResult from a push frame. If compression is enabled on the WebSocket, then messages will come gzipped. This method will decompress the payload if necessary. The gzip format allows for less bandwidth usage, at the cost of a slight CPU increase for message decompression.extract_websocket_options(TikTokLive.client.ws.ws_utils) — Options are a cookie-style string, so we parse with SimpleCookie from the stdlib.proto_extension(TikTokLive.proto.custom_proto) — Betterproto doesn’t properly handle inheriting existing messages. This method takes the superclass proto metadata and assigns that to this one.user_agent_to_device_preset(TikTokLive.client.web.web_presets) — Convert a user agent string to a DevicePreset