Pytube is a Python 3 library designed for downloading YouTube videos and playlists. It handles various resolutions, formats, and audio-only extractions. Currently at version 15.0.0, it maintains an active release cadence, primarily updating to adapt to frequent changes in YouTube's frontend, which it scrapes to function.
pip install pytubeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a YouTube object with a video URL and download the highest resolution stream to a local 'downloads' directory. It includes basic error handling.
Update `pytube` to the latest version immediately if you encounter download failures or errors. Check the GitHub repository for recent issues or workarounds.
If you need to download age-restricted content, you must implement an OAuth flow (using `pytube.request.get_auth_gmt()`) to obtain necessary cookies for authentication. Refer to the `pytube` documentation for authentication examples.
Ensure the URL points to a non-live video. There is no built-in `pytube` mechanism to download ongoing live streams.
If download speeds are unusually slow or downloads fail, update `pytube` to the latest version. This issue is usually addressed quickly by the maintainers.
Upgrade pytube to the latest version using `pip install --upgrade pytube` to get the updated regex patterns.
Upgrade pytube to the latest version using `pip install --upgrade pytube`, as newer versions often include fixes for these YouTube changes.
Install the library using pip: `pip install pytube`.
Verify the video URL is correct and that the video is publicly available without restrictions (e.g., age or region).
No dependency data recorded yet.