An unofficial Python SDK Library for CHZZK
Project description
chzzk-sdk
네이버 라이브 스트리밍 서비스 치치직(CHZZK)의 비공식 API 라이브러리.
공부 목적으로 만들었으며, 참조한 레포는 하단의 References에 명시했습니다.
- 로그인 (쿠키 사용)
- 검색 (채널, 영상, 생방송)
- 채널 정보 조회
- 방송 상태 및 상세 정보 조회
- 채팅 보내기
- 이벤트 구독
- 연결 상태 (on_connect, on_disconnect)
- 채팅 (on_chat)
- 방송 상태 (on_broadcast_open, on_broadcast_close)
- 후원 (on_donation)
- 구독 (on_subscription)
- 상단 고정 (on_pin, on_unpin)
- 시스템 메시지 (on_system_message)
- 메시지 관리
- 그 외 (on_recent_chat, on_notice, on_blind, on_mission_pending, on_mission_approved, on_mission_rejected, on_mission_completed)
- 채팅 커맨드 생성
@client.commands(name="커맨드이름") - 관리 (채팅 제한, 상단 고정 설정)
Requirements
- Python 3.11+
Installation
pip install chzzk-sdk
Example
import asyncio
from chzzk import ChzzkChat, Chzzk
from chzzk.model import ChatMessage
from dotenv import dotenv_values
env = dotenv_values(".env")
chzzk = Chzzk().from_data(auth=env.get("AUTH"), session=env.get("SESSION"))
chat = ChzzkChat(chzzk=chzzk, prefix="!") # commands를 위한 prefix 지정
@chat.event
async def on_connect():
print(f"on_connect")
await chat.send_chat("on_connect test")
@chat.event
async def on_chat(message: ChatMessage):
print(f"on_chat: {message.content}")
@chat.commands(name="공지")
async def notice(message: ChatMessage, *args):
await chat.pin_message(message=message)
# name가 없으면, 함수이름이 커맨드 명령어 이름이 됨.
@chat.commands()
async def 공지해제(*args):
await chat.unpin_message()
@chat.commands(name="덧셈")
async def plus(message: ChatMessage, *args):
nums = list(map(lambda x: int(x), args))
await chat.send_chat(f"덧셈 결과: {sum(nums)}")
async def main():
channels = await chzzk.search.channels("갈대s")
channel_id = channels[0].channel.channel_id
await chat.run(channel_id=channel_id)
if __name__ == "__main__":
asyncio.run(main())
+ 간단한 tts-bot 코드 : https://github.com/westreed/ChzzkBot
References
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chzzk_sdk-0.1.3.tar.gz.
File metadata
- Download URL: chzzk_sdk-0.1.3.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b24fb5887c33968ad4fb0553ac3b5abf18f832b42f4728f4d9424e29df4d4b9
|
|
| MD5 |
d846224982b7410f8a93017af258a434
|
|
| BLAKE2b-256 |
3f0b427b4c790cb10d9e0b70a716ab4c152a417650d9adb3bc1a67ccdf948636
|
Provenance
The following attestation bundles were made for chzzk_sdk-0.1.3.tar.gz:
Publisher:
deploy.yml on saebyeok0306/chzzk-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chzzk_sdk-0.1.3.tar.gz -
Subject digest:
4b24fb5887c33968ad4fb0553ac3b5abf18f832b42f4728f4d9424e29df4d4b9 - Sigstore transparency entry: 157658984
- Sigstore integration time:
-
Permalink:
saebyeok0306/chzzk-sdk@58a44fee67962acec1f6d715fa2ec5eacd0c55ef -
Branch / Tag:
refs/heads/main - Owner: https://github.com/saebyeok0306
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@58a44fee67962acec1f6d715fa2ec5eacd0c55ef -
Trigger Event:
push
-
Statement type:
File details
Details for the file chzzk_sdk-0.1.3-py3-none-any.whl.
File metadata
- Download URL: chzzk_sdk-0.1.3-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d34a9c449f37f649b1e996a4267d7fba4526fdc032491919beea5b9e21117efb
|
|
| MD5 |
a531764cbb0c99af91cdf63122e6117a
|
|
| BLAKE2b-256 |
0d6b841a841e2010a1a05ba20a90811d22aee1df52cf8d2e92d072fcfd2b6bbb
|
Provenance
The following attestation bundles were made for chzzk_sdk-0.1.3-py3-none-any.whl:
Publisher:
deploy.yml on saebyeok0306/chzzk-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chzzk_sdk-0.1.3-py3-none-any.whl -
Subject digest:
d34a9c449f37f649b1e996a4267d7fba4526fdc032491919beea5b9e21117efb - Sigstore transparency entry: 157658985
- Sigstore integration time:
-
Permalink:
saebyeok0306/chzzk-sdk@58a44fee67962acec1f6d715fa2ec5eacd0c55ef -
Branch / Tag:
refs/heads/main - Owner: https://github.com/saebyeok0306
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@58a44fee67962acec1f6d715fa2ec5eacd0c55ef -
Trigger Event:
push
-
Statement type: