ytube-noapi
v1.0.0
Published
A YouTube client using only InnerTube API - NO Google API key or project required!
Maintainers
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 installUsage
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 buildExample 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 APIComparison
| 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
- Zero Setup - No Google Cloud Console, no API keys, just install and use
- No Quotas - YouTube Data API v3 has 10,000 units/day limit. InnerTube has none.
- No Costs - Never worry about quota overages or billing
- Always Works - No "API not enabled" or "quota exceeded" errors
- 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
