A powerful, purely client-side JavaScript library for searching YouTube videos without an official API key. Built with modern JavaScript, zero dependencies, and comprehensive caching.
- No API Key Required - Works with YouTube's InnerTube API
- 100% Client-Side - No server code needed (with configurable CORS proxies)
- Smart Caching - LRU cache with
localStoragepersistence - TypeScript Support - Full type definitions included
- Zero Dependencies - Pure JavaScript, no bloat
- Works Everywhere - Browser and Node.js compatible
npm install yt-search-libimport { YouTubeClient } from 'yt-search-lib';
const client = new YouTubeClient({
proxyUrl: 'http://127.0.0.1:3000/proxy?url=' // or use Render, etc.
});
const results = await client.search('lofi hip hop', { limit: 5 });
results.forEach(video => console.log(video.title));Complete documentation is in the /docs directory.
- Getting Started Guide - Setup in 5 minutes
- API Reference - Complete API documentation
- Usage Examples - React, Express, and more
- Deployment Guides - Deploy locally or to Render
- Troubleshooting - Solve common problems
- Architecture - How it works under the hood
- Contributing - Help improve the library
npm install yt-search-libconst client = new YouTubeClient({
proxyUrl: 'https://your-proxy.com/proxy?url=', // Required for browsers
useCache: true, // Enable caching
cacheMaxAge: 3600000 // 1 hour cache TTL
});See API Reference for all configuration options.
Browsers block direct requests to YouTube. You must use a CORS proxy:
- Development:
http://127.0.0.1:3000/proxy?url=(runnpm run proxy:start) - Production: Deploy your own proxy or use Render
See Deployment Guide for options.
| Goal | Guide |
|---|---|
| Search from React | React Integration |
| Build API backend | Express.js Integration |
| Deploy to production | Deployment Options |
| Handle errors | Error Handling |
| Optimize caching | Caching Strategy |
| Fix a problem | Troubleshooting |
npm run build # Build the library
npm run test # Run tests
npm run test:integration:proxy # Integration tests with proxy
npm run proxy:start # Start local CORS proxy
npm run lint # Run ESLint
npm run format # Format with PrettierSee Development Guide for details.
MIT - See LICENSE file for details
We welcome contributions! See Contributing Guide and Code of Conduct.
- Questions? → Support & Help
- Found a bug? → GitHub Issues
- Have an idea? → GitHub Discussions
Ready to get started? → Full Documentation
