Registry / http-networking / youtube-search-python

youtube-search-python

JSON →
library1.6.6pypypi✓ verified 83d ago

A library to search for YouTube videos, channels, playlists, and retrieve video information without using the YouTube Data API v3. Uses InnerTube (YouTube's internal API) internally. Current version 1.6.6 is the final release; the project is deprecated. The author recommends migrating to yt-dlp for streaming and video info, and alternatives like youtube-search for searching.

pip install youtube-search-python
INSTALL
IMPORT
SIG · YOUTUBE-SEARCH-PYT
Y
youtube-search-python
http-networkingpythonv1.6.6
Install
2.1s avg
Import
236ms
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.6.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.242s · 22.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.230s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

VideosSearch
from youtubesearchpython import VideosSearch
from youtubesearch import VideosSearch
Package is 'youtubesearchpython', not 'youtubesearch'
ChannelSearch
from youtubesearchpython import ChannelSearch
PlaylistsSearch
from youtubesearchpython import PlaylistsSearch
Video
from youtubesearchpython import Video
Used to get video info by URL
StreamURLFetcher
from youtubesearchpython import StreamURLFetcher
Deprecated in v1.6.6, use yt-dlp directly
Channel
from youtubesearchpython import Channel
Added in v1.6.3
Playlist
from youtubesearchpython import Playlist
Comments
from youtubesearchpython import Comments
Added in v1.6.0

Search for videos and print title and link.

from youtubesearchpython import VideosSearch videos_search = VideosSearch('Never Gonna Give You Up', limit=2) result = videos_search.result() for video in result['result']: print(video['title'], video['link'])
Debug
Known issues
deprecatedThe library is deprecated as of v1.6.6 (final release). No further updates will be provided. It may break at any time due to YouTube changes.
fix
Migrate to alternative libraries: yt-dlp for streaming, youtube-search or google-api-python-client for searching.
affects: >=1.6.6
breakingStreamURLFetcher and Video.get() for streaming URLs now require yt-dlp (since v1.6.1). They no longer use PyTube.
fix
Ensure yt-dlp is installed: pip install yt-dlp. Or use yt-dlp directly.
affects: >=1.6.1
gotchaThe package name is 'youtube-search-python' (PyPI), but the import module is 'youtubesearchpython'. Many users mistakenly import 'youtubesearch'.
fix
Use 'from youtubesearchpython import ...' (no dash, no underscore).
affects: all
gotchaSearch results may include age-restricted or unavailable videos. The library may raise exceptions for such content.
fix
Wrap searches in try-except to handle failures gracefully.
affects: all
breakingPlaylist class now uses InnerTube API (since v1.5.3). Series playlists are handled differently.
fix
Check updated documentation for Playlist class API changes.
affects: >=1.5.3
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'youtubesearch'
Incorrect import path; the module is 'youtubesearchpython' not 'youtubesearch'.
fix
Use 'from youtubesearchpython import ...' instead of 'from youtubesearch import ...'.
AttributeError: module 'youtubesearchpython' has no attribute 'VideosSearch'
Older version of library (pre-1.0) or misspelled class name.
fix
Upgrade to latest version (pip install --upgrade youtube-search-python) and use correct class name: VideosSearch.
KeyError: 'result'
The search result dictionary structure changed between versions, or an error occurred during search.
fix
Check the returned object: print(result.keys()) and adapt your code. Also wrap in try-except to catch search failures.
Upgrade
Version history
1.6.6latest on PyPI · released Jun 23, 2022
Audit
Dependencies
httpxrequiredHTTP client for API requests
yt-dlprequiredUsed by StreamURLFetcher and Video for audio/video stream URLs (since v1.6.1)
Agent activity
33 hits · last 30 days
node
24
OpenAI (training)
1
Resources
youtube-search-python — pip install youtube-search-python · libregistry