pytube “HTTP Error 400: Bad Request”
pytube talks to YouTube's internal endpoints directly. When YouTube changes what those endpoints expect, pytube's requests get rejected with HTTP 400 until the library is updated.
Quick checks
- Upgrade:
pip install -U pytube— then check whether a fix has been released. - Try the community fork pytubefix, which has shipped fixes for several of these breakages.
- Test with a different, public, non-age-restricted video to rule out a video-specific issue.
The stable fix
If downloads are part of a product, move away from client-side extraction. A hosted API like CrawlFetch returns the same information as JSON from a stable endpoint. See the Python guide and pytube alternatives.
FAQ
Is HTTP 400 my fault?
Usually not — it typically starts for all users at once after a YouTube change.
Related
Last updated 2026-10-25