@bluetree242/youtube-chat
TypeScript icon, indicating that this package has built-in type declarations

1.1.8 • Public • Published

youtube-chat

Fetch Youtube live chat without API

This module is a fork of youtube-chat, which was written by LinaTsukusu and fixed up by IcedCoffeee, then it was used for freetube.. and was fixed again by BlueTree242.

Since all those people don't work on it anymore, i had to fix the bugs myself.

You will need to take full responsibility for your actions

Getting started

  1. Install
    • npm i @freetube/youtube-chat
    • yarn add @freetube/youtube-chat
  2. Import
    • Javascript
    const LiveChat = require('@freetube/youtube-chat').LiveChat
    • Typescript
    import {LiveChat} from '@freetube/youtube-chat'
  3. Create instance with ChannelID or LiveID
    // If channelId is specified, liveId in the current stream is automatically acquired.
    const liveChat = new LiveChat({channelId: 'UCxkOLgdNumvVIQqn5ps_bJA?'})
    
    // Or specify LiveID in Stream manually.
    const liveChat = new LiveChat({liveId: 'bc5DoKBZRIo'})
  4. Add events
    // Emit at start of observation chat.
    // liveId: string
    liveChat.on('start', (liveId) => {})
    
    // Emit at end of observation chat.
    // reason: string?
    liveChat.on('end', (reason) => {})
    
    // Emit at receive chat.
    // comment: CommentItem
    liveChat.on('comment', (comment) => {})
    
    // Emit when an error occurs
    // err: Error
    liveChat.on('error', (err) => {})

Types

CommentItem

interface CommentItem {
  id: string
  author: {
    name: string
    thumbnail?: ImageItem
    channelId: string
    badge?: {
      thumbnail: ImageItem
      label: string
    }
  }
  message: MessageItem[]
  superchat?: {
    amount: string
    color: number
  }
  membership: boolean
  isOwner: boolean
  timestamp: number
}

MessageItem

type MessageItem = { text: string } | ImageItem

ImageItem

interface ImageItem {
  url: string
  alt: string
  width: number
  height: number
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.1.84latest

Version History

VersionDownloads (Last 7 Days)Published
1.1.84
1.1.70
1.1.60
1.1.50
1.1.40

Package Sidebar

Install

npm i @bluetree242/youtube-chat

Weekly Downloads

3

Version

1.1.8

License

MIT

Unpacked Size

24.6 kB

Total Files

15

Last publish

Collaborators

  • bluetree242