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

To install the development version.

$ git clone https://github.com/gunyu1019/chzzk_py
$ chzzk_py
$ python3 -m pip install -U .

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.3.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

chzzkpy-1.0.3-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for chzzkpy-1.0.3.tar.gz
Algorithm Hash digest
SHA256 23c8f2f5d0bd49ce6f4327320734bf89c9aed3e455ade6e190869236aba11948
MD5 48195799e790b6e50de735e937017a4b
BLAKE2b-256 0362dd0ce071b2c2335c05f461fd2983a2c019d2ddbe3dd16e51964d5ff87a7d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for chzzkpy-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aa5acaad040c674fd876399a5e2941a4bca39e72ee66f341352fd165bf2cb570
MD5 25e3fad45d65ba71f2c3657a64916db9
BLAKE2b-256 4281217a94599c22cfb1ae64249d580a019a345dd316daa26d7cb9a4a067871d

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