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

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

This was a known bug with pytube.

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

Method 2

Version 10.8.5 solves the problem. Upgrade with

python -m pip install --upgrade pytube

Method 3

first uninstall the pytube

python -m pip uninstall pytube pytube3 pytubex

and install latest one

python -m pip install git+https://github.com/nficano/pytube

Method 4

Someone here was successful using the latest version of pytube.
I already did all steps of https://pypi.org/project/pytube/ and https://github.com/nficano/pytube but still with error _execute_request

Have you already tested it on Python 3.8.5?


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x