Socket
Book a DemoInstallSign in
Socket

@freetube/youtube-chat

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@freetube/youtube-chat

> Fetch Youtube live chat without API

1.1.2
latest
Source
npmnpm
Version published
Maintainers
3
Created
Source

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.

Since the original maintainer doesn't work on this package, we forked it and maintain it for the needs of FreeTube.

You will need to take full responsibility for your actions

Getting started

  • Install
    • npm i youtube-chat
    • yarn add youtube-chat
  • Import
    • Javascript
    const LiveChat = require('youtube-chat').LiveChat
    
    • Typescript
    import {LiveChat} from 'youtube-chat'
    
  • 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'})
    
  • 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
}

Keywords

youtube

FAQs

Package last updated on 21 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.