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

@miukyo/ytlc

v0.1.3

Published

Unofficial JavaScript library for reading YouTube live chat via InnerTube

Readme

@miukyo/ytlc Library Guide

@miukyo/ytlc is a TypeScript/JavaScript library for receiving YouTube live chat events.

YTLiveChat Service API

This library is centered on the YTLiveChat service.

1. Create service instance

import { YTLiveChat } from "@miukyo/ytlc";

const livechat = new YTLiveChat(options);

Required constructor options: none.

options is optional (YTLiveChatOptions). Most users can start with new YTLiveChat().

2. Subscribe to events

livechat.on("chatReceived", ({ chatItem }) => {
  console.log(chatItem.author.name);
});

Return type:

  • livechat.on(...) returns this (chainable).

3. Start monitoring

await livechat.start({ handle: "@YouTubeChannelHandle" });

Required start options: at least one of:

  • handle
  • channelId
  • liveId

Return type:

  • start(...) returns Promise<void>.

4. Stop / stream / dummy helpers

  • stop(reason?) -> void
  • sendDummy(options?) -> ChatItem
  • streamChatItems(...) -> AsyncIterable<ChatItem>
  • streamRawActions(...) -> AsyncIterable<RawActionReceivedEventArgs>

Type Reference

Import types from the package root:

import type {
  ChatItem,
  MembershipDetails,
  MessagePart,
  StartOptions,
  SendDummyOptions,
  YTLiveChatOptions,
  YTLiveChatEvents,
} from "@miukyo/ytlc";

Source references:

  • Models: src/types/models.ts
  • Options: src/types/options.ts
  • Events: src/types/events.ts
  • Service interface: src/interfaces/i-yt-live-chat.ts

Most commonly used types:

  • YTLiveChatOptions: constructor configuration
  • StartOptions: required target (handle or channelId or liveId) for start(...)
  • ChatItem: parsed chat payload emitted in chatReceived
  • SendDummyOptions: shape for sendDummy(...)

Install

npm install @miukyo/ytlc

Quick Start

import { YTLiveChat } from "@miukyo/ytlc";

const livechat = new YTLiveChat({ requestFrequency: 1000 });

livechat.on("initialPageLoaded", ({ liveId }) => {
  console.log("Monitoring", liveId);
});

livechat.on("chatReceived", ({ chatItem }) => {
  const text = chatItem.message
    .map((part) => (part.type === "text" ? part.text : part.alt ?? part.url))
    .join("");

  console.log(`${chatItem.author.name}: ${text}`);
});

livechat.on("errorOccurred", ({ error }) => {
  console.error(error.message);
});

await livechat.start({ handle: "@YouTubeChannelHandle" });

Stream API

for await (const item of chat.streamChatItems({ liveId: "VIDEO_ID" })) {
  console.log(item.author.name);
}

Local Dummy Events

Use the same pipeline without network calls:

chat.sendDummy({
  mode: "text",
  text: "local test message",
  authorName: "dev-bot",
});

Reconnect Behavior

  • autoReconnect: enable retry behavior.
  • reconnectMaxAttempts: maximum retry attempts before stopping.
  • reconnectDelayMs: fixed interval between retries.

Common Start Options

  • handle: channel handle (@...)
  • channelId: channel id (UC...)
  • liveId: direct live video id
  • overwrite: restart active session

Notes

  • This is an unofficial parser over YouTube internal payloads. Schema may change anytime.

Credits