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

Uploaded Source

Built Distribution

chzzkpy-1.0.2-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chzzkpy-1.0.2.tar.gz
  • Upload date:
  • Size: 19.9 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.2.tar.gz
Algorithm Hash digest
SHA256 998469a00c5436506525b65f94ca007ae71381fd5110074205a389b1d112ebb8
MD5 bcc47b43c3f7a7a5110dad8464515321
BLAKE2b-256 5529b59e34fe0a143f08dae9f470c98a7de244f93fef22c8f870ce8e5fdea9c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chzzkpy-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 37.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c7e37881b3e54d0d27af51ba87618e88933ad9c5fbe3e0e998b4d12e357e3c4a
MD5 fa35e1bde9ab2c62c6f4e0d5a0c390be
BLAKE2b-256 c49eb06e3eef1189fdef95bbbc514c739e7e319d887b02a183ca0446d631268e

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