Hello,im trying to do a youtube video downloader script,so i did this:
but i dont want to put the url in the code,I want the user to insert it when the program is started,so i did
import pytube video_url = 'https://www.youtube.com/watch?v=4KcMdH8qiuk' youtube = pytube.YouTube(video_url) video = youtube.streams.first() video.download('/home/dream/Downloads')
but i dont want to put the url in the code,I want the user to insert it when the program is started,so i did
import pytube video_url = input() youtube = pytube.YouTube(video_url) video = youtube.streams.first() video.download('/home/dream/Downloads')but this return me error:
Error:Traceback (most recent call last):
File "/home/dream/.local/lib/python3.8/site-packages/pytube/extract.py", line 288, in apply_descrambler
stream_data[key] = [
File "/home/dream/.local/lib/python3.8/site-packages/pytube/extract.py", line 290, in <listcomp>
"url": format_item["url"],
KeyError: 'url'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "youtube2.py", line 3, in <module>
youtube = pytube.YouTube(video_url)
File "/home/dream/.local/lib/python3.8/site-packages/pytube/__main__.py", line 92, in __init__
self.descramble()
File "/home/dream/.local/lib/python3.8/site-packages/pytube/__main__.py", line 132, in descramble
apply_descrambler(self.player_config_args, fmt)
File "/home/dream/.local/lib/python3.8/site-packages/pytube/extract.py", line 300, in apply_descrambler
cipher_url = [
File "/home/dream/.local/lib/python3.8/site-packages/pytube/extract.py", line 301, in <listcomp>
parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)
KeyError: 'cipher'