Skip to content

A Modern Upgraded Version of youtube-search-python Library With httpx 0.28.1+ Support , Features Youtube Songs , Videos , Playlists , Channels , Comments , Hashtags, Transcripts Using thier id or yt_url Without YouTube Data API_KEY v3.

License

Notifications You must be signed in to change notification settings

BillaSpace/yt-search-python

Repository files navigation

📮 YouTube Search Python v2.0.0

  • now known as :- yt-search-python

yt-search-python

GitHub Stars GitHub Forks Python Version License

Search YouTube without the YouTube Data API v3

A professional, Modern & actively maintained Python library for searching YouTube content—completely free and without youtube data API quotas.

FeaturesInstallationQuick StartDocumentationExamplesTesting


✨ Features

  • 🚀 No API Key Required - Search YouTube without quotas or rate limits
  • Fast & Reliable - Optimized for performance with modern httpx
  • 🔄 Sync & Async Support - Use synchronous or asynchronous methods
  • 📦 Rich Metadata - Get videos, channels, playlists, comments, transcripts & more
  • 🎯 Advanced Filtering - Sort by date, views, duration, and more
  • 🌐 Multi-Region - Search with language and region preferences
  • 🔧 Modern - Compatible with Python 3.7+ to current and httpx 0.28+
  • 💪 Type Hints - Full type annotations for better IDE support

Old youtube-search-python User?

  • if your are old user of this library & confused while migration to this library don't be confused just remove _ _ future _ _ imports to youtube-search-python.future only

📦 Installation

Via Pip

pip3 install yt-search-python

Via Git

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

Via git requirements.txt

git+https://github.com/BillaSpace/youtube-search-python.git

🚀 Quick Start

Search for Videos

from youtubesearchpython import VideosSearch

search = VideosSearch('NoCopyrightSounds', limit=10)
print(search.result())

Get Video Information

from youtubesearchpython import Video

video = Video.get('https://www.youtube.com/watch?v=aqz-KE-bpKQ')
print(video['title'])
print(video['viewCount'])

Async Support

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())

📚 Documentation

Core Documentation

Key Classes

Search Classes

  • VideosSearch - Search for videos
  • ChannelsSearch - Search for channels
  • PlaylistsSearch - Search for playlists
  • CustomSearch - Search with custom filters
  • ChannelSearch - Search within a specific channel

Content Classes

  • Video - Get video information and formats
  • Playlist - Get playlist information and videos
  • Channel - Get channel information
  • Comments - Get video comments
  • Transcript - Get video transcripts/captions
  • Suggestions - Get search suggestions
  • Recommendations - Get video recommendations
  • Hashtag - Get videos by hashtag

Utility Classes

  • StreamURLFetcher - Get direct stream URLs with multiple formats
  • ResultMode - Control output format (dict/json)

💡 Examples

Advanced Search with Filters

from youtubesearchpython import CustomSearch, VideoSortOrder

# Search videos sorted by view count
search = CustomSearch('Python', VideoSortOrder.viewCount, limit=10)
print(search.result())

Get Playlist Videos

from youtubesearchpython import Playlist

# Works with both URLs and IDs
playlist = Playlist.get('PLRBp0Fe2GpgmsW46rJyudVFlY6IYjFBIK')
print(f"Playlist: {playlist['title']}")
print(f"Videos: {len(playlist['videos'])}")

Fetch Comments

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']}")

Get Search Suggestions

from youtubesearchpython import Suggestions

suggestions = Suggestions.get('Arijit Singh', language='en', region='US')
print(suggestions['result'])

For more examples, see the examples directory.


🧪 Testing

Wanna Quick Test ?

cd tests
python3 full_execution.py

This comprehensive test suite covers:

  • ✅ All search classes (Videos, Channels, Playlists, Custom)
  • ✅ Content retrieval (Video, Playlist, Channel)
  • ✅ Social features (Comments, Recommendations, Suggestions)
  • ✅ Advanced features (StreamURLFetcher, Transcript)
  • ✅ Both synchronous and asynchronous methods

Test Documentation

See tests/README.md for detailed testing information.


🔧 Advanced Features

Pagination

search = VideosSearch('Python', limit=10)
print(search.result())

# Get next page
search.next()
print(search.result())

🌎 Language & Region

search = VideosSearch('Music', limit=10, language='es', region='ES')

Custom Filters

Available filters:

  • Upload Date: VideoUploadDateFilter.lastHour, .today, .thisWeek, .thisMonth, .thisYear
  • Duration: VideoDurationFilter.short, .long
  • Sort Order: VideoSortOrder.relevance, .uploadDate, .viewCount, .rating

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.


⚠️ Disclaimer

This library is not affiliated with YouTube or Google Inc. It uses YouTube's internal API which may change without notice. Use responsibly and in accordance with YouTube's Terms of Content usage and distribution Services.


🔁 Credits


🌟 Support & Future of the Library

  • If you find this library useful, please consider to support the developer by giving a fork & ✳️ star on GitHub ,

  • if i found this library is really useful n necessary for everyone i'll keep maintaining on pypi as -; yt-search-python


Made with ❤️ for the community

Report BugRequest Feature

About

A Modern Upgraded Version of youtube-search-python Library With httpx 0.28.1+ Support , Features Youtube Songs , Videos , Playlists , Channels , Comments , Hashtags, Transcripts Using thier id or yt_url Without YouTube Data API_KEY v3.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 15

Languages