I get the error sometimes when downloading a video. For example, I can attempt to download the video and it will download, the next time I run the script that video will not download and the error will be thrown.
def search_youtube(song,randomString,playlist_name):
results = YoutubeSearch(song, max_results=1).to_dict()
for v in results:
url = 'https://www.youtube.com' + v['link']
print(url)
_filename = song
format_input = 'mp4'
format_output = 'mp3'
print("Downloading...." + ' ' + song)
time.sleep(5)
YouTube(url).streams.first().download(filename=randomString,output_path=playlist_name)
I have just fixed this issue. Follow these steps.
pip show pytube3
. You'll see location of site-packages.parse_qs(formats[i]["cipher"]) for i, data in enumerate(formats)
formats[i]["cipher"]
with signatureCipher . Thus that line becomes,
parse_qs(formats[i]["signatureCipher"]) for i, data in enumerate(formats)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With