Skip to content

πŸ”Ž Search for YouTube videos, channels & playlists. Get 🎞 video & πŸ“‘ playlist info using link. Get search suggestions. WITHOUT YouTube Data API v3.

License

Notifications You must be signed in to change notification settings

CertifiedCoders/youtube-search-python

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”Ž youtube-search-python

Search YouTube videos, channels, and playlists β€” without using the YouTube Data API v3.

PyPI - Version PyPI - Downloads Python

⚠️ 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.


✨ Features

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

πŸ“¦ Installation

Quick Install

pip install git+https://github.com/CertifiedCoders/youtube-search-python.git

Install from Dev Branch

pip install git+https://github.com/CertifiedCoders/youtube-search-python.git@dev

Install from Source

git clone https://github.com/CertifiedCoders/youtube-search-python.git
cd youtube-search-python
pip install -e .

Requirements

  • Python: 3.7–3.13
  • httpx: >= 0.28.1 (installed automatically)

πŸ’‘ Tip: Default timeout is 10 seconds. Override by passing timeout parameter (in seconds) to class constructors.


πŸš€ Quick Start

Synchronous API

from youtubesearchpython import VideosSearch

videosSearch = VideosSearch('NoCopyrightSounds', limit=2)
print(videosSearch.result())

Asynchronous API

from youtubesearchpython.aio import VideosSearch
import asyncio

async def main():
    videosSearch = VideosSearch('NoCopyrightSounds', limit=2)
    result = await videosSearch.next()
    print(result)

asyncio.run(main())

πŸ“š Documentation

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

🎯 Choose Your Path

For Beginners

Start with the Synchronous API β€” it's straightforward and blocking, perfect for simple scripts and learning.

For Advanced Users

Use the Asynchronous API for high-performance applications, web servers, and concurrent operations.


πŸ“– Common Use Cases

πŸ” 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())

⚠️ Important Notes

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.


🀝 Contributors

Thanks to everyone contributing to this library, including those not mentioned here.

Current Maintainer

  • CertifiedCoders - Current fork maintainer, actively maintaining the project with modern Python support and bug fixes

Original Project Contributors

Contributors are listed in no particular order. We appreciate all contributions, reports, and feedback.

πŸ“ Recent Updates

Version 1.7.0 includes:

  • Renamed async module from __future__ to aio for 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

πŸ“„ License

MIT License

Copyright (c) 2021 Hitesh Kumar Saini
Copyright (c) 2022-2025 CertifiedCoders (Fork maintainer)

πŸ”— Links

About

πŸ”Ž Search for YouTube videos, channels & playlists. Get 🎞 video & πŸ“‘ playlist info using link. Get search suggestions. WITHOUT YouTube Data API v3.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%