Search YouTube videos, channels, and playlists β without using the YouTube Data API v3.
β οΈ Note: The original project by Hitesh Kumar Saini has not been maintained since June 23, 2022.
This is an actively maintained fork by CertifiedCoders with modern Python support (3.7β3.13) and continued updates.
| Feature | Description |
|---|---|
| π Search | Videos, channels, playlists, and custom searches with filters |
| πΉ Video Information | Get video details, formats, thumbnails, and metadata |
| π Comments | Retrieve video comments with pagination support |
| π Transcripts | Access video transcripts in multiple languages |
| π¬ Playlists | Full playlist support with pagination |
| πΊ Channels | Channel information and playlist retrieval |
| π Stream URLs | Direct stream URL fetching (requires yt-dlp) |
| β‘ Async Support | High-performance asynchronous API |
| π― No API Key | Works without YouTube Data API v3 |
pip install git+https://github.com/CertifiedCoders/youtube-search-python.gitpip install git+https://github.com/CertifiedCoders/youtube-search-python.git@devgit clone https://github.com/CertifiedCoders/youtube-search-python.git
cd youtube-search-python
pip install -e .- Python: 3.7β3.13
- httpx: >= 0.28.1 (installed automatically)
π‘ Tip: Default timeout is 10 seconds. Override by passing
timeoutparameter (in seconds) to class constructors.
from youtubesearchpython import VideosSearch
videosSearch = VideosSearch('NoCopyrightSounds', limit=2)
print(videosSearch.result())from youtubesearchpython.aio import VideosSearch
import asyncio
async def main():
videosSearch = VideosSearch('NoCopyrightSounds', limit=2)
result = await videosSearch.next()
print(result)
asyncio.run(main())| Document | Description |
|---|---|
| π Synchronous API | Complete guide to the synchronous API with examples |
| β‘ Asynchronous API | Complete guide to the asynchronous API with examples |
| π» Sync Examples | Comprehensive synchronous examples |
| π» Async Examples | Comprehensive asynchronous examples |
Start with the Synchronous API β it's straightforward and blocking, perfect for simple scripts and learning.
Use the Asynchronous API for high-performance applications, web servers, and concurrent operations.
π Search for Videos
Sync:
from youtubesearchpython import VideosSearch
videosSearch = VideosSearch('NoCopyrightSounds', limit=10)
print(videosSearch.result())Async:
from youtubesearchpython.aio import VideosSearch
import asyncio
async def main():
videosSearch = VideosSearch('NoCopyrightSounds', limit=10)
result = await videosSearch.next()
print(result)
asyncio.run(main())πΉ Get Video Information
Sync:
from youtubesearchpython import Video
video = Video.get('https://www.youtube.com/watch?v=z0GKGpObgPY')
print(video)Async:
from youtubesearchpython.aio import Video
import asyncio
async def main():
video = await Video.get('https://www.youtube.com/watch?v=z0GKGpObgPY')
print(video)
asyncio.run(main())π¬ Work with Playlists
Sync:
from youtubesearchpython import Playlist
playlist = Playlist('https://www.youtube.com/playlist?list=PLRBp0Fe2GpgmsW46rJyudVFlY6IYjFBIK')
print(f'Videos Retrieved: {len(playlist.videos)}')
while playlist.hasMoreVideos:
playlist.getNextVideos()
print(f'Videos Retrieved: {len(playlist.videos)}')Async:
from youtubesearchpython.aio import Playlist
import asyncio
async def main():
playlist = Playlist('https://www.youtube.com/playlist?list=PLRBp0Fe2GpgmsW46rJyudVFlY6IYjFBIK')
await playlist.init()
while playlist.hasMoreVideos:
await playlist.getNextVideos()
print(f'Videos Retrieved: {len(playlist.videos)}')
asyncio.run(main())Legal Notice: YouTube's Terms of Service may restrict commercial use. Please respect the law and YouTube's terms when using this library.
Technical Details: This library simulates the requests made by YouTube's web client during client-side rendering. It fetches the JSON data internally used by YouTube when navigating the website, not webpage HTML.
Thanks to everyone contributing to this library, including those not mentioned here.
- CertifiedCoders - Current fork maintainer, actively maintaining the project with modern Python support and bug fixes
- Hitesh Kumar Saini - Original creator
- mytja - Core classes, Comments and Transcript classes, yt-dlp migration
- Denis (raitonoberu) - Hashtag class, maintainer and reviewer
- Fabian Wunsch (fabi321) - ChannelSearch & Playlist fixes
- Felix Stupp (Zocker1999NET) - Video and Playlist class contributor
- dscrofts - Extensive issues, mostly about Playlist and Video class
- AlexandreOuellet - Added publishDate and uploadDate to Video class
- rking32 - Bumped httpx version to 0.14.2
- Elter (Maple-Elter) - Fixes to Playlist class
Contributors are listed in no particular order. We appreciate all contributions, reports, and feedback.
Version 1.7.0 includes:
- Renamed async module from
__future__toaiofor cleaner, clearer, and more intuitive async imports - Robust YouTube URL cleaning and video ID extraction supporting watch, shorts, live, youtu.be, and playlist formats
- Centralized utility formatters for view counts, durations, publish time, and channel metadata with consistent outputs
- Major refactors in video data retrieval to reduce duplication and unify sync/async logic for better performance
- Improved client architecture with ANDROID as the default and stronger MWEB fallback handling
- Enhanced stream URL fetching with duplicate format prevention and improved compatibility with YouTube API changes
- Cleaner project structure and documentation with consolidated examples and updated installation/upgrade guidance
MIT License
Copyright (c) 2021 Hitesh Kumar Saini
Copyright (c) 2022-2025 CertifiedCoders (Fork maintainer)