Skip to content

dhkimxx/GoChzzkChatCrawler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chzzk Chat Crawler Golang Library

crawling

This library provides a crawler for streaming game chat messages from Chzzk game streaming platform. It captures real-time chat data, including usernames and messages, and allows users to process or store this information for further analysis or application integration.

Features

  • Real-time crawling of chat messages.
  • Support for custom message handling.
  • Easy integration with Go applications.

Installation

Requirements

  • Go 1.22.2 or higher

To install, ensure that you have Go 1.22.2 or a later version installed. You can verify your Go version by running:

go version # >= 1.22.2 

To use this library, you need to have Go installed. You can install the library by running the following command in your project:

go get github.com/dhkimxx/GoChzzkChatCrawler

Usage

Below is an example of how to use this library in your project.

Example Code

  1. Using a Callback Handler

    package main
    
    import (
        "fmt"
    
        "github.com/dhkimxx/GoChzzkChatCrawler/crawler"
    )
    
    func main() {
        streamerId := "<your_streamer_id>"
    
        // Create a new crawler client with callback handler
        crawlerClient := crawler.NewCrawlerClient(streamerId, 1, func(msg crawler.ChzzkChatMessage) {
            fmt.Printf("[%d] %s: %s\n", msg.Timestamp, msg.Nickname, msg.Content)
        })
    
        // Start crawling
        err := crawlerClient.Run()
        if err != nil {
            panic(err)
        }
    }
  2. Using a Channel

    package main
    
    import (
        "fmt"
    
        "github.com/dhkimxx/GoChzzkChatCrawler/crawler"
    )
    
        streamerId := "<your_streamer_id>"
    
        // Create a new crawler client
        crawlerClient := crawler.NewCrawlerClient(streamerId, 1, nil)
    
        // Start crawling in a separate Goroutine
        go func() {
            err := crawlerClient.Run()
            if err != nil {
                panic(err)
            }
        }()
    
        // Process chat messages from the channel
        for msg := range crawlerClient.ChatChan {
            fmt.Printf("[%d] %s: %s\n", msg.Timestamp, msg.Nickname, msg.Content)
        }

ETC

You can check the streamer id from the streamer broadcast page URL as shown in the image below. (https://chzzk.naver.com/live/<streamer_id>)

streamer-id-guide

About

네이버 게임 스트리밍 서비스 "치지직"의 채팅 크롤러 라이브러리

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages