Skip to main content

An unofficial Python library of Chzzk(Naver live-streaming service)

Project description

chzzkpy

PyPI - Version PyPI - Downloads PyPI - License

파이썬 기반의 치지직(네이버 라이브 스트리밍 서비스)의 비공식 라이브러리 입니다.
채팅 기능을 중점으로 개발하였으며, 다른 기능도 개발될 예정입니다.

An unofficial python library for Chzzk(Naver Live Streaming Service).
This library focused on chat. However, other feature will be developed.

Available Features

  • 채팅
    • 사용자 상호 채팅 (on_chat <-> client.send_chat)
    • 사용자 후원 (on_donation)
    • 메시지 상단 고정하기 (on_pin, on_unpin)
    • 시스템 메시지 (on_system_message)
    • 메시지 관리
  • 로그인 (쿠키 값 NID_AUT, NID_SES 사용)
  • 검색 (채널, 영상, 라이브, 자동완성)
  • 방송 상태 조회

Installation

Python 3.10 or higher is required.

# Linux/MacOS
python3 -m pip install chzzkpy

# Windows
py -3 -m pip install chzzkpy

Quick Example

chzzkpy를 사용한 예제는 Examples에서 확인하실 수 있습니다.
아래는 간단한 예제입니다.

방송인 검색

import asyncio
import chzzkpy

loop = asyncio.get_event_loop()
client = chzzkpy.Client(loop=loop)

async def main():
    result = await client.search_channel("건유1019")
    if len(result) == 0:
        print("검색 결과가 없습니다 :(")
        return
    print(result[0].name)
    print(result[0].id)
    print(result[0].image)
    await client.close()

loop.run_until_complete(main())

챗봇 (Chat-Bot)

from chzzkpy.chat import ChatClient, ChatMessage, DonationMessage

client = ChatClient("channel_id")


@client.event
async def on_chat(message: ChatMessage):
    if message.content == "!안녕":
        await client.send_chat("%s님, 안녕하세요!" % message.profile.nickname)


@client.event
async def on_donation(message: DonationMessage):
    await client.send_chat("%s님, %d원 후원 감사합니다." % (message.profile.nickname, message.extras.pay_amount))


client.run("NID_AUT", "NID_SES")

Contributions

chzzkpy의 기여는 언제든지 환영합니다!
버그 또는 새로운 기능은 Pull Request로 진행해주세요.

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

chzzkpy-1.0.1.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

chzzkpy-1.0.1-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

Details for the file chzzkpy-1.0.1.tar.gz.

File metadata

  • Download URL: chzzkpy-1.0.1.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.9

File hashes

Hashes for chzzkpy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3d3fa3593b194a9b21449db26dde911ac90f81ff7f740c8a4e2ce278ccba7546
MD5 0fa192c6a3294f3cec6fa335e101bd38
BLAKE2b-256 69ba8665b7aac210cfa17c3fbd88b95498c7f8c2cc4dcffeedb4407b9d97c2d9

See more details on using hashes here.

File details

Details for the file chzzkpy-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: chzzkpy-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.9

File hashes

Hashes for chzzkpy-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 28e97f2369c660525f2f33d3f4947f0b39f9e39ed9987a3af4f24ea9b708ae96
MD5 d68811bd70b12b85cca2b56e6722d0a5
BLAKE2b-256 46ca981dccf6ec8895c5f5b7fe8a8fa66b991c8fd33e394978f1a873718fdf8d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page