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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ytube-noapi

v1.0.0

Published

A YouTube client using only InnerTube API - NO Google API key or project required!

Readme

YTube-NoAPI

A YouTube client using ONLY YouTube's internal InnerTube API - NO Google API key or project required!

🎉 Key Highlights

  • NO API Key Required - Works immediately, no setup needed
  • NO Google Cloud Project - No quotas, no billing, no limits
  • NO Authentication - Just install and use
  • Full TypeScript Support - Complete type definitions
  • Same Interface - Drop-in replacement for API-based clients

Features

  • Search - Search for videos, channels, and playlists
  • Video Details - Get comprehensive video information including statistics
  • Trending Videos - Access trending content
  • Playlists - Fetch playlist details and videos
  • Related Videos - Get related/recommended videos
  • Channel Information - Get channel details
  • Search Suggestions - Autocomplete functionality
  • URL Parsing - Extract video/playlist IDs from URLs
  • Duration Utilities - Parse and format video durations

Installation

pnpm install

Usage

Basic Example

import { YTubeNoAPI } from './src/index';

const youtube = new YTubeNoAPI();

// Search for videos - NO API KEY NEEDED!
const videos = await youtube.searchVideos('typescript tutorial', 10);

// Get video details
const video = await youtube.getVideo('dQw4w9WgXcQ');

// Get trending videos
const trending = await youtube.getTrending();

// Get search suggestions
const suggestions = await youtube.getSuggestions('javascript');

API Methods

Search

// Search for videos
const videos = await youtube.searchVideos('query', maxResults);

// Search for channels
const channels = await youtube.searchChannels('query', maxResults);

// Search for playlists
const playlists = await youtube.searchPlaylists('query', maxResults);

// General search (returns all types)
const results = await youtube.search('query', {
  type: 'all' // 'video', 'channel', 'playlist', or 'all'
});

Video Details

// Get single video
const video = await youtube.getVideo('videoId');

// Get multiple videos
const videos = await youtube.getVideos(['id1', 'id2', 'id3']);

// Get related videos
const related = await youtube.getRelatedVideos('videoId', 10);

Channels

// Get channel by ID
const channel = await youtube.getChannel('channelId');

Playlists

// Get playlist details
const playlist = await youtube.getPlaylist('playlistId');

// Get videos in playlist
const videos = await youtube.getPlaylistVideos('playlistId', 50);

Trending

// Get trending videos
const trending = await youtube.getTrending();

Utilities

// Get search suggestions (autocomplete)
const suggestions = await youtube.getSuggestions('query');

// Parse duration from ISO 8601 to seconds
const seconds = youtube.parseDuration('PT1H30M15S'); // 5415

// Format seconds to human readable
const formatted = youtube.formatDuration(5415); // "1:30:15"

// Extract video ID from URL
const videoId = youtube.extractVideoId('https://youtube.com/watch?v=dQw4w9WgXcQ');

// Extract playlist ID from URL
const playlistId = youtube.extractPlaylistId('https://youtube.com/playlist?list=...');

// Generate URLs
const videoUrl = youtube.getVideoUrl('videoId');
const playlistUrl = youtube.getPlaylistUrl('playlistId');
const channelUrl = youtube.getChannelUrl('channelId');

Running Examples

# Run the demo (works immediately!)
pnpm demo

# Run examples
pnpm example

# Build TypeScript
pnpm build

Example Output

=== YTube-NoAPI Demo - NO API Key Required! ===

✅ YTubeNoAPI initialized successfully - NO Google API key needed!

1. Searching for videos: "typescript tutorial"...
   Found 5 videos:

   1. TypeScript Tutorial for Beginners
      Channel: Programming with Mosh
      Views: 2.1M views
      Duration: 51:45
      URL: https://www.youtube.com/watch?v=...

...

✅ Demo completed successfully!

🎉 All features work WITHOUT any Google API key or project!
📦 ytube-noapi uses only YouTube's internal InnerTube API

Comparison

| Feature | ytube-noapi | ytube-api | youtube-sr | |---------|-------------|-----------|------------| | API Key Required | ❌ NO | ✅ Yes | ❌ NO | | Google Project | ❌ NO | ✅ Yes | ❌ NO | | Rate Limits | ❌ NO | ✅ Yes (10k/day) | ❌ NO | | Search | ✅ | ✅ | ✅ | | Video Details | ✅ | ✅ | ✅ | | Trending | ✅ | ✅ | ✅ | | Playlists | ✅ | ✅ | ✅ | | Channels | ✅ | ✅ | ✅ | | Related Videos | ✅ | ✅ | ✅ | | TypeScript | ✅ Full | ✅ Full | ⚠️ Basic | | Data Quality | ✅ High | ✅ Very High | ✅ High |

How It Works

YTube-NoAPI uses YouTube's internal InnerTube API - the same API that YouTube's web and mobile clients use. This means:

  • ✅ No authentication required
  • ✅ No API keys or tokens
  • ✅ No rate limits or quotas
  • ✅ Always up-to-date with YouTube's interface
  • ✅ Access to the same data YouTube's own clients see

Advantages Over API-Based Solutions

  1. Zero Setup - No Google Cloud Console, no API keys, just install and use
  2. No Quotas - YouTube Data API v3 has 10,000 units/day limit. InnerTube has none.
  3. No Costs - Never worry about quota overages or billing
  4. Always Works - No "API not enabled" or "quota exceeded" errors
  5. Real-Time Data - Same data YouTube's own interface displays

When to Use ytube-noapi vs ytube-api

Use ytube-noapi when:

  • You want zero setup/configuration
  • You don't want to deal with API keys
  • You need unlimited requests
  • You're building a hobby project or prototype
  • You want to avoid Google Cloud Console setup

Use ytube-api when:

  • You need official Google support
  • You want guaranteed API stability
  • You're building enterprise applications
  • You need features like comments (not in InnerTube)
  • You prefer official APIs over internal ones

TypeScript Support

Full type definitions included:

import type { SearchOptions } from './src/types';

const options: SearchOptions = {
  type: 'video',
  maxResults: 10,
};

const videos = await youtube.search('query', options);

Response Format

All methods return clean, parsed data:

{
  type: 'video',
  id: 'dQw4w9WgXcQ',
  title: 'Rick Astley - Never Gonna Give You Up',
  duration: '3:33',
  thumbnail: 'https://...',
  channelId: 'UCuAXFkgsw1L7xaCfnd5JJOw',
  channelName: 'Rick Astley',
  views: '1.4B views',
  publishedTime: '15 years ago',
  url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
}

Error Handling

try {
  const video = await youtube.getVideo('videoId');
  if (!video) {
    console.log('Video not found or unavailable');
  }
} catch (error) {
  console.error('Error:', error.message);
}

Limitations

Since this uses InnerTube (not the official API), some features are not available:

  • ❌ Comments (use ytube-api for this)
  • ❌ Video categories
  • ❌ Channel by username (only by ID)
  • ❌ Advanced filtering options

For these features, check out ytube-api which combines official API with InnerTube.

License

MIT