Basic Feature

Client

class Client(loop: AbstractEventLoop | None = None, authorization_key: str | None = None, session_key: str | None = None)

Represents a client to connect Chzzk (Naver Live Streaming).

async autocomplete(keyword: str) list[str]

Get a auto-completed keyword.

Parameters:

keyword (str) – Incomplete keywords

Returns:

Autocompleted keywords

Return type:

list[str]

async close()

Closes the connection to chzzk.

property is_closed: bool

Indicates if the session is closed.

async live_detail(channel_id: str) LiveDetail | None

Get a live detail info of broadcaster.

Parameters:

channel_id (str) – The channel ID of broadcaster

Returns:

Return LiveDetail info. Sometimes the broadcaster is not broadcasting, returns None.

Return type:

Optional[LiveDetail]

async live_status(channel_id: str) LiveStatus | None

Get a live status info of broadcaster.

Parameters:

channel_id (str) – The channel ID of broadcaster

Returns:

Return LiveStatus info. Sometimes the broadcaster is not broadcasting, returns None.

Return type:

Optional[LiveStatus]

login(authorization_key: str, session_key: str)

Login at Chzzk. Used for features that require a login. (ex. user method)

Parameters:
  • authorization_key (str) – A NID_AUT value in the cookie.

  • session_key (str) – A NID_SES value in the cookie.

manage(channel_id: str | None = None) ManageClient

Get a client provided broadcast management functionality.

Parameters:

channel_id (Optional[str]) – A channel id to manage broadcasts. The default value is the last channel id used. If initally use the manage method and don’t have a channel_id argument, it will raise a TypeError exception.

Returns:

Return a client provided broadcast management functionality.

Return type:

ManageClient

async search_channel(keyword: str) list[Channel]

Search the channel with keyword.

Parameters:

keyword (str) – A keyword to search channel

Returns:

Returns channels with searching.

Return type:

list[Channel]

async search_live(keyword: str) list[Live]

Search the live with keyword.

Parameters:

keyword (str) – A keyword to search live

Returns:

Returns lives with searching.

Return type:

list[Video]

async search_video(keyword: str) list[Video]

Search the video with keyword.

Parameters:

keyword (str) – A keyword to search video

Returns:

Returns videos with searching.

Return type:

list[Video]

async user() User

Get my user info. This method should be used after login.

Returns:

Information for logged-in user.

Return type:

User

Enumerations

class UserRole
channel_manager = 'streaming_channel_manager'
chat_manager = 'streaming_chat_manager'
common_user = 'common_user'
manager = 'manager'
settlement_manager = 'streaming_settlement_manager'
streamer = 'streamer'

Channel

class PartialChannel
id: str
image: str | None
name: str
personal_data: ChannelPersonalData | None
verified_mark: bool
class Channel

Bases: PartialChannel

description: str
follower: int
open_live: bool
class ChannelPersonalData
private_user_block: bool

User

class PartialUser
async add_restrict()

Add this user to restrict activity.

async add_role(role: UserRole)

Add a broadcast permission to this user.

Parameters:

role (UserRole) – A enumeration class containing broadcast role. It can only set the role to UserRole.chat_manager, UserRole.settlement_manager, or UserRole.channel_manager. Giving any other role will cause a TypeError exception.

async chat_activity_count() ChatActivityCount

Get chat activity count of this user.

Returns:

Returns a chat activity count object contains the count of temporary activity restrictions, the count of activity restrictions, and the count of chats.

Return type:

ChatActivityCount

nickname: str | None
profile_image_url: str | None
async remove_restrict()

Remove this user to restrict activity.

async remove_role()

Remove a broadcast permission to this user.

user_id_hash: str | None
verified_mark: bool
class User
has_profile: bool
logged_in: bool | None
official_noti_agree: bool
official_noti_agree_updated_date: Annotated[datetime.datetime | None, BeforeValidator(ChzzkModel.special_date_parsing_validator)]
penalties: list[Any] | None

Video

class PartialVideo
duration: int
id: str | None
number: int
publish_date: Annotated[datetime | None, BeforeValidator(func=special_date_parsing_validator)]
thumbnail_image_url: str | None
title: str
type: str
class Video
adult: bool
category_type: str | None
channel: PartialChannel | None
channel_id: str
read_count: int
video_category: str | None
video_category_value: str

Exceptions

exception LoginRequired

Exception that’s raised when a method need login.

exception HTTPException

Exception that’s raised when an HTTP request operation fails.

exception NotFound

Exception that’s raised for when status code 404 occurs.