A lightweight Python library to search YouTube without using the official YouTube Data API.
Search videos, channels, playlists, suggestions, comments, transcripts, and more with simple sync and async APIs.
Features • Installation • Quick Start • Documentation • Examples • Testing
- No YouTube Data API key required — search YouTube without official API keys or quota setup.
- Sync and async support — use the library in normal scripts or async apps.
- Video, channel, and playlist search — search multiple YouTube content types.
- Rich metadata — fetch video info, channels, playlists, comments, suggestions, recommendations, and transcripts.
- Advanced filtering — sort and filter by upload date, duration, relevance, views, and more.
- Multi-region support — use language and region preferences.
- Stream helper utilities — optional helpers for working with stream URLs.
- Modern HTTP client — built with modern
httpxsupport. - Type hints — improved developer experience with IDE autocomplete and type checking.
- Docs and tests included — examples and test files are available in the repository.
This project is actively maintained by SkyBotsDeveloper.
The goal of this library is to make YouTube search integration easier for Python developers building bots, search tools, automation workflows, and apps.
This project is not affiliated with YouTube or Google.
If you used the older youtube-search-python style imports and are migrating to this version, update future/async imports like this:
# Old style
from youtubesearchpython.__future__ import VideosSearch
# New style
from youtubesearchpython.future import VideosSearchpip install git+https://github.com/SkyBotsDeveloper/youtube-search-python.gitgit+https://github.com/SkyBotsDeveloper/youtube-search-python.git
Some stream URL features may require yt-dlp to be installed:
pip install yt-dlpfrom youtubesearchpython import VideosSearch
search = VideosSearch("NoCopyrightSounds", limit=10)
result = search.result()
print(result)from youtubesearchpython import Video
video = Video.get("https://www.youtube.com/watch?v=aqz-KE-bpKQ")
print(video["title"])
print(video["viewCount"])import asyncio
from youtubesearchpython.future import VideosSearch, Video
async def main():
search = VideosSearch("Python Tutorial", limit=5)
result = await search.next()
print(result)
video = await Video.get("video_id_here")
print(video)
asyncio.run(main())- API Reference — complete API documentation with classes and methods.
- Usage Examples — examples for search, video info, playlists, streams, and more.
- Search Examples — search classes and filters.
- Video and Extras Examples — video, playlist, comments, and related features.
- Stream URL Examples — stream URL helper usage.
VideosSearch— search for videos.ChannelsSearch— search for channels.PlaylistsSearch— search for playlists.CustomSearch— search with custom filters.ChannelSearch— search inside a specific channel.
Video— get video information and formats.Playlist— get playlist information and videos.Channel— get channel information.Comments— get video comments.Transcript— get video transcripts or captions.Suggestions— get search suggestions.Recommendations— get video recommendations.Hashtag— get videos by hashtag.
StreamURLFetcher— get stream URLs with supported formats.ResultMode— control output format such asdictorjson.
from youtubesearchpython import CustomSearch, VideoSortOrder
search = CustomSearch("Python", VideoSortOrder.viewCount, limit=10)
print(search.result())from youtubesearchpython import Playlist
playlist = Playlist.get("PLRBp0Fe2GpgmsW46rJyudVFlY6IYjFBIK")
print(f"Playlist: {playlist['title']}")
print(f"Videos: {len(playlist['videos'])}")from youtubesearchpython import Comments
comments = Comments.get("https://www.youtube.com/watch?v=aqz-KE-bpKQ")
for comment in comments["result"][:5]:
print(f"{comment['author']}: {comment['content']}")from youtubesearchpython import Suggestions
suggestions = Suggestions.get("Arijit Singh", language="en", region="US")
print(suggestions["result"])from youtubesearchpython import VideosSearch
search = VideosSearch("Python", limit=10)
print(search.result())
search.next()
print(search.result())from youtubesearchpython import VideosSearch
search = VideosSearch("Music", limit=10, language="es", region="ES")
print(search.result())Available filter groups include:
- Upload Date:
VideoUploadDateFilter.lastHour,.today,.thisWeek,.thisMonth,.thisYear - Duration:
VideoDurationFilter.short,.long - Sort Order:
VideoSortOrder.relevance,.uploadDate,.viewCount,.rating
cd tests
python3 full_execution.pyThe test suite covers:
- Search classes such as videos, channels, playlists, and custom search.
- Content retrieval such as video, playlist, and channel details.
- Social features such as comments, recommendations, and suggestions.
- Advanced features such as stream helpers and transcripts.
- Both synchronous and asynchronous usage.
For more details, see tests/README.md.
Contributions are welcome.
You can help by:
- Reporting bugs
- Suggesting features
- Improving documentation
- Adding tests
- Fixing compatibility issues
- Improving reliability when YouTube changes its structure
Please read CONTRIBUTING.md before opening a pull request.
If you find a security issue, please do not open a public issue.
Read SECURITY.md for responsible reporting instructions.
This project is licensed under the MIT License.
See the LICENSE file for more details.
This library is not affiliated with YouTube or Google.
It may use YouTube internal endpoints or publicly available web data that can change without notice. Features may break if YouTube changes its structure.
Use this library responsibly and follow YouTube's Terms of Service and content usage rules.
- Maintainer: SkyBotsDeveloper
- Telegram: @iflexelite
If you find this library useful, please consider supporting it by giving the repository a star and fork on GitHub.
Made with ❤️ for the developer community
