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

tubezero

v1.1.0

Published

Zero-dependency, ultra-lightweight YouTube InnerTube client optimized for client-side environments, browser extensions, and hybrid apps.

Downloads

25

Readme

TubeZero

📖 Full API Documentation & Snippets

A modular collection of JavaScript functions designed to scrape and reverse-engineer data from YouTube using its private internal API (InnerTube). This library is built to be ultra-lightweight, free of heavy external dependencies, and optimized for client-side environments (such as browser extensions or desktop applications).


⚖️ Comparison with Other Libraries

To ensure complete transparency, here is a comparison between TubeZero and the other main InnerTube libraries available on GitHub:

| Feature/Property | TubeZero (This Project) | LuanRT/YouTube.js (youtubei.js) | SuspiciousLookingOwl/youtubei | | :--- | :--- | :--- | :--- | | Architecture | Lite, pure fetch client, zero external dependencies | Full-featured monolithic SDK mapping almost all renderers | Object-oriented TypeScript query client | | Optimization | Client-side & Web-Extension optimized | Heavy backend/server-side oriented | Node.js oriented with class-based queries | | Pros & Use Cases | Extremely lightweight, fast, no compilation required. Native extraction of SAPISID and SAPISIDHASH via Web Crypto API for authenticated requests. | Complete coverage of features (deciphering video download signatures, live chat, dedicated interfaces for Music/Studio/Kids). | Class-based abstractions, clean TypeScript interface for querying videos, channels, and playlists. | | Limitations | Lacks video download deciphering, full catalog of renderer schemas, and dedicated YT Music/Studio/Kids interfaces. | Large bundle size, complex codebase, requires polyfills/build tools to run in client/extension frontends. | Requires compilation, coupled with Node.js dependencies, not designed for direct client-side integration. |


⚠️ Important Note on CORS and Cookies

When this library is executed in a standard browser environment (e.g., on a standard website like myapp.com), requests to youtube.com/youtubei will be blocked due to browser CORS policies.

Recommended Execution Environments:

  1. Browser Extensions: Optimal. By granting host permissions for https://*.youtube.com/* in manifest.json, the extension bypasses CORS and can read session cookies directly to compute the SAPISIDHASH for authenticated requests.
  2. Desktop & Mobile Applications (Electron, Tauri, React Native): By controlling HTTP headers and disabling CORS, these applications can run the library natively.
  3. Server-side Environments (Node.js) with a CORS Proxy: Requests can be routed through a reverse proxy that removes header restrictions.

📦 Installation (Package Structure)

To prepare the package for local usage or NPM publishing:

# Initialize the package if exported into a dedicated folder
npm init -y

Add "type": "module" in your package.json to enable loading of ES modules.


💻 Usage Examples

The primary way to interact with TubeZero is through the Client class. For a full list of examples, check out the Documentation.

1. Initialization and Searching

Search for videos, playlists, or channels.

import { Client } from 'tubezero';

const youtube = new Client();

const results = await youtube.search("Rick Astley", { type: "video" });
console.log(results.items[0].title); // "Rick Astley - Never Gonna Give You Up"

2. Fetching a Video and its Comments

Retrieve full metadata, streaming data, and comments for a video.

import { Client } from 'tubezero';

const youtube = new Client();
const video = await youtube.getVideo("dQw4w9WgXcQ");

console.log(`Title: ${video.title}`);
console.log(`Views: ${video.viewCount}`);

// Load the first page of comments
const comments = await video.comments.next();
comments.forEach(c => {
    console.log(`[${c.author.name}]: ${c.content}`);
});

3. Fetching a Playlist

Retrieve a playlist and paginate through its videos.

import { Client } from 'tubezero';

const youtube = new Client();
const playlist = await youtube.getPlaylist("PLtbcYJeD7QZ34kS_L8H-lV7J8xT6rU0k_");

// Load all pages
while (playlist.videos.hasMore) {
    await playlist.videos.next();
}

console.log(`Total videos loaded: ${playlist.videos.items.length}`);

🛡️ Legal Disclaimer

This tool is intended solely for educational, research, and study purposes regarding third-party web architectures. It is not associated, affiliated, sponsored, or endorsed by Google LLC or YouTube. The user assumes full civil and administrative liability arising from the use of these functions and any potential violation of YouTube's Terms of Service. The authors are not responsible for IP blocks, account bans, or other actions taken by YouTube as a result of using this library.