Search code examples
pythonhttp-status-code-404pytube

Pytube givng an "HTTP Error 404: Not Found" error. Anyone knows how to fix this?


I'm having a problem trying to use the pytube package to download a video from YouTube.

I'm getting a "HTTP Error 404: Not Found" error. Is anyone familiar with this error? I've been trying to research about this but yet to find anything that causes the problem.

I will share my code and the error below:

from pytube import YouTube

video = YouTube("https://youtu.be/sflWFZKFJgk")

print(video.title)
print("downloading...")

video.streams.get_highest_resolution().download()

print('Downloaded successfully!')

The error:

HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found

Solution

  • This was a known bug with pytube.

    python -m pip install --upgrade pytube it got fixed.