yt-search-python v2.1.1 🚩
Search and read YouTube data (videos, playlists, channels, comments, transcripts) without the YouTube Data API v3 — no API key, no quota limits.
Installation • Quick Start • Key Classes • Examples • Known Limitations • Testing
What this library does
It talks to YouTube's own internal (innertube) endpoints — the same ones the youtube.com website itself calls — and parses the JSON back into clean Python structures. Both a synchronous API (youtubesearchpython) and an async API (youtubesearchpython.future) are provided, sharing the same underlying parsing logic so their results match.
Previous users of youtube-search-python: replace youtubesearchpython.__future__ imports with youtubesearchpython.future — nothing else changes.
Installation
pip3 install yt-search-python
Or from source:
pip install git+https://github.com/BillaSpace/yt-search-python.git
Quick Start
Search for videos
from youtubesearchpython import VideosSearch
search = VideosSearch('Hindutva', limit=10)
print(search.result())
Get video info + streaming formats
from youtubesearchpython import Video
video = Video.get('https://www.youtube.com/watch?v=aqz-KE-bpKQ')
print(video['title'], video['viewCount'])
Async
import asyncio
from youtubesearchpython.future import VideosSearch, Video
async def main():
search = VideosSearch('Learn Python', limit=5)
print(search.result())
await search.next() # next page
print(search.result())
video = await Video.get('aqz-KE-bpKQ')
print(video['title'])
asyncio.run(main())
Key Classes
Search
VideosSearch,ChannelsSearch,PlaylistsSearch,CustomSearch,ChannelSearch
Content
Video— info + streaming formats (Video.get,Video.getInfo,Video.getFormats)Playlist— one-shotPlaylist.get(...), or instantiatePlaylist(link)for.getNextVideos()paginationChannel—Channel.get(...), or instantiate +.init()/.next()for paginationComments—Comments.get(...), or instantiate +.init()/.getNextComments()Transcript—Transcript.get(link, params=<languageCode>)to select a specific caption trackHashtag— instantiateHashtag(tag, limit=...)(fetches immediately) orHashtag.get(...)Suggestions— autocomplete text suggestions.Suggestions.get(...)for one-shot use,Suggestions.session(...)(async: same) to reuse a client across many callsRecommendations— related/up-next videos for a video ID
Utility
StreamURLFetcher— direct stream URLs (needsyt-dlp&denoinstalled in your system)ResultMode—.dictor.jsonoutput
Note: Suggestions (autocomplete text) and Recommendations (related videos) are deliberately separate classes — different endpoints, different data — not merged into one.
Examples
Advanced search with filters
from youtubesearchpython import CustomSearch, VideoSortOrder
search = CustomSearch('Python', VideoSortOrder.viewCount, limit=10)
print(search.result())
Playlist videos (works with a URL or a bare ID)
from youtubesearchpython import Playlist
playlist = Playlist.get('PLRBp0Fe2GpgmsW46rJyudVFlY6IYjFBIK')
print(playlist['info']['title'], len(playlist['videos']))
Comments
from youtubesearchpython import Comments
comments = Comments.get('https://www.youtube.com/watch?v=aqz-KE-bpKQ')
for c in comments['result'][:5]:
print(c['author']['name'], ':', c['content'])
Search suggestions
from youtubesearchpython import Suggestions
print(Suggestions.get('Arijit Singh', language='en', region='US'))
Pagination
search = VideosSearch('Python', limit=10)
print(search.result())
search.next()
print(search.result())
Language & region
search = VideosSearch('Music', limit=10, language='es', region='ES')
Filters available
- Upload date:
VideoUploadDateFilter.lastHour,.today,.thisWeek,.thisMonth,.thisYear - Duration:
VideoDurationFilter.short,.long - Sort order:
VideoSortOrder.relevance,.uploadDate,.viewCount,.rating
Known Limitations
Being upfront about what this library can't do, rather than silently under-delivering:
- Mix / Radio playlists (IDs starting with
RD…) are auto-generated by YouTube through a different, session-based mechanism than regular playlists, and aren't returned by the standard browse endpoint this library uses.Playlist.get()will raise a clearYouTubeParseErroridentifying this case rather than crashing with an unrelatedTypeError— but it won't fetch the mix's videos. - Recommendations reflect what YouTube's own backend returns for an anonymous, session-less request to the
/nextendpoint — without real watch history or a signed-in session, YouTube itself mixes in generic suggestions alongside genuinely related videos. This is backend behavior, not something a scraper can fully correct. - This library depends entirely on YouTube's internal response shapes, which change without notice. If something breaks, it's almost always a shape change on YouTube's end.
Covers all search classes, content retrieval, comments/recommendations/suggestions, StreamURLFetcher, transcripts — both sync and async.
Contributing
- Fork the repository
- Create a feature branch
- Commit and push
- Open a Pull Request
License
MIT — see LICENSE.
Disclaimer
Not affiliated with YouTube or Google. Uses YouTube's publically available internal endpoints, which may change without notice. Use responsibly and in accordance with YouTube's Terms of Service.
Credits
» Current maintainer: Prakhar Shukla
» Original author: Hitesh Kumar Saini
Full acknowledgements
- Thanks to CertifiedCoder for his work on the request layer[ v2.0.0.]
- Built on top of the original
youtube-search-pythonproject and its contributors.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yt_search_python-2.1.1.tar.gz.
File metadata
- Download URL: yt_search_python-2.1.1.tar.gz
- Upload date:
- Size: 45.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9072aa413390de88a4b4e2a7f71d455aea82f4965eec18490c97bc18dc0bbb0
|
|
| MD5 |
6a0cf3e44485211a86de27b59a0deb2d
|
|
| BLAKE2b-256 |
c3f99315006451870eee2cc65dc1bfef16a0d2a308330f6a27b289b6c75869a0
|
File details
Details for the file yt_search_python-2.1.1-py3-none-any.whl.
File metadata
- Download URL: yt_search_python-2.1.1-py3-none-any.whl
- Upload date:
- Size: 54.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42fb9ff3a436e501c62f4606048f84cadb740c6821bd4b7a10c3fa0fb9d5d560
|
|
| MD5 |
d40d00f96baaed232305877729d4fd06
|
|
| BLAKE2b-256 |
b141a8f95e57a6eacaea10fc1ce8a8f0be2aaf65d75ca31128ccf7576fe633e3
|