'Cant donwload Video with pytube(HTTP Error 403:Forbidden)
I am trying to download a YouTube video with the module pytube, but when i use the method to download a video, it tells me:
urllib.error.HTTPError: HTTP Error 403: Forbidden
from pytube import YouTube
yt = YouTube("https://www.youtube.com/watch?v=9bZkp7q19f0")
stream = yt.streams.first()
stream.download()
How can i work around this restriction?
Solution 1:[1]
As of August 4 2021, there has been a fix in ver 11. Simply download uninstall with pip uninstall pytube and then reinstall with pip install pytube and it should be fixed.
Solution 2:[2]
Experienced the same problem. I found unfinished downloaded file in the project folder. After deleting the unfinished downloaded file and running stream.download() again, it worked. So maybe worth checking.
Or like BoarGules mentioned in the comment, it could be a cooldown and try again later (But this happened the first time I am using pytube, never did any downloads before).
pytube version 12.0.0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | SiefElDin |
Solution 2 | S7bvwqX |