npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

chzzk

v1.10.4

Published

네이버 라이브 스트리밍 서비스 CHZZK의 비공식 API 라이브러리

Readme

CHZZK

npm version install size npm downloads license

네이버 라이브 스트리밍 서비스 CHZZK의 비공식 API 라이브러리입니다.

현재 구현된 기능은 다음과 같습니다.

  • 로그인 (쿠키 사용)
  • 검색 (채널, 영상, 생방송, 라운지, 자동완성)
  • 채널 정보 조회
  • 방송 상태 및 상세 정보 조회
  • 채팅
  • 관리 (채팅 제한, 활동 제한, 방송 설정, 금칙어 설정 등)

설치

Node 18 이상에서만 동작합니다.

npm install chzzk
pnpm add chzzk
yarn add chzzk

예시

chzzk.naver.com 에 로그인 하신 후, 개발자 도구를 열어 Application > Cookies > https://chzzk.naver.com 에서 NID_AUTNID_SES 쿠키를 확인하실 수 있습니다.

// 로그인 옵션 (선택사항)
const options = {
    nidAuth: "NID_AUT 쿠키",
    nidSession: "NID_SES 쿠키"
}

const client = new ChzzkClient(options)

// 채널 검색
const result = await client.search.channels("녹두로")
const channel = result.channels[0]

// 설정된 방송 정보, 방송 중이 아닐 경우에도 정보가 존재할 수 있음
const liveDetail = await client.live.detail(channel.channelId)

if (liveDetail) {
    const media = liveDetail.livePlayback.media // 방송 중이 아닐 경우 비어있음
    const hls = media.find(media => media.mediaId === "HLS") // HLS, LLHLS

    if (hls) {
        const m3u8 = await client.fetch(hls.path).then(r => r.text())
        console.log(m3u8)
    }
}

// 채팅 인스턴스 생성
const chzzkChat = client.chat({
    channelId: channel.channelId,
    // chatChannelId 의 변경을 감지하기 위한 polling 요청의 주기 (선택사항, ms 단위)
    // channelId를 지정할 경우 자동으로 30초로 설정됨, 0초로 설정 시 polling 요청을 하지 않음
    pollInterval: 30 * 1000
})

chzzkChat.on('connect', () => {
    console.log('Connected')

    // 최근 50개의 채팅 및 고정 메시지를 요청 (선택사항, 도네 및 시스템 메시지 포함이므로 주의)
    chzzkChat.requestRecentChat(50)
})

// 재연결 (방송 시작 시)
chzzkChat.on('reconnect', newChatChannelId => {
    console.log(`Reconnected to ${newChatChannelId}`)
})

// 일반 채팅
chzzkChat.on('chat', chat => {
    const message = chat.hidden ? "[블라인드 처리 됨]" : chat.message
    console.log(`${chat.profile.nickname}: ${message}`)

    // 유저의 팔로우 일시 불러오기
    // client.chat.profileCard(chzzkChat.chatChannelId, chat.profile.userIdHash).then(profile => {
    //     const following = profile.streamingProperty.following
    //     console.log(following ? `${following.followDate} 에 팔로우 함` : "팔로우 안함")
    // })
})

// 후원 채팅
chzzkChat.on('donation', donation => {
    console.log(`\n>> ${donation.profile?.nickname ?? "익명의 후원자"} 님의 ${donation.extras.payAmount}원 ${donationTypeName(donation.extras.donationType)}`)
    if (donation.message) {
        console.log(`>> ${donation.message}`)
    }
    console.log()
})

// 구독
chzzkChat.on('subscription', subscription => {
    console.log(`${subscription.profile.nickname} 님이 ${subscription.extras.month} 개월 동안 ${subscription.extras.tierName} 구독중`)
})

// 시스템 메시지 (채팅 제한, 활동 제한, 운영자 임명 등)
chzzkChat.on('systemMessage', systemMessage => {
    console.log(systemMessage.extras.description)
})

// 고정 메시지
chzzkChat.on('notice', notice => {
    // 고정 해제 시 null
    console.log(notice)
})

// RAW 이벤트
// chzzkChat.on('raw', raw => {
//     console.log(raw)
// })

// 채팅 연결
await chzzkChat.connect()

브라우저 사용

ChzzkChat 은 브라우저 환경에서도 사용이 가능합니다.

// Webpack 등의 모듈 번들러를 통해 사용할 경우
import {ChzzkChat} from "chzzk"

// script 태그에서 사용할 경우
import {ChzzkChat} from "https://cdn.skypack.dev/chzzk"
// chatChannelId, accessToken 값을 제공해야 합니다. (해당 값들은 서버 환경에서만 불러올 수 있음)
const client = new ChzzkChat({
    chatChannelId,
    accessToken
})

CORS 우회 방법

baseUrls 옵션을 설정하여 ChzzkClient가 요청을 보내는 API 주소를 변경할 수 있습니다.

해당 옵션을 설정할 경우 브라우저 (클라이언트) 에서도 ChzzkClient의 사용이 가능합니다.

const client = new ChzzkClient({
    baseUrls: {
        chzzkBaseUrl: "https://api.chzzk.naver.com",
        gameBaseUrl: "https://comm-api.game.naver.com/nng_main"
    }
})