pytube: KeyError: 'streamingData' when trying to download video
This happens when I try to download a video using pytube. Here is the code:
import pytube
def download_video(video_url):
youtube = pytube.YouTube(video_url)
print("Be patient. I am now downloading your video.")
video = youtube.streams.get_highest_resolution()
video.download(output_path="../Downloads")
print("Video Downloaded Successfully")
download_video(input("Paste Video Link: "))
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 27
Commits related to this issue
- Using oauth as problem from YouTube update Implement fix from https://github.com/pytube/pytube/issues/1586 — committed to perfect-less/Python-YouTube-Downloader by perfect-less a year ago
Figured it out. This was as a result of an update by YouTube.
If you encounter this same error, modify
youtube = pytube.YouTube(video_url)
toyoutube = pytube.YouTube(video_url, use_oauth=True, allow_oauth_cache=True)
This way you have to authenticate with your browser once and it’ll keep working.
It works. thanks!!
how to use it on a host server like railway?? it needs authentication.
PROBLEM SOLUTION: Upgrade pytube.
Worked fine for me.
Thanks, It works for me, I expanded on your script with a list ill leave the code here in case its useful to anyone:
This what ive done to solve the problem