I try to download playlist using pytube3 library with this code
import pytube
import os
# download playlist
playlist = pytube.Playlist(
"https://www.youtube.com/playlist?list=PLQVvvaa0QuDcjD5BAw2DxE6OF2tius3V3")
i = 1
print(len(playlist.video_urls))
for link in playlist:
#if i < 51:
# break
#i = i + 1
# continue
yt = pytube.YouTube(link)
file = yt.streams.get_highest_resolution().download() #"D:\YOUTUBE\Gabrysia"
# find last backslash, because it is followed by an relative path
# and insert number in the beginning
last_backslash = file.rfind("\\")
res = list(file)
res.insert(last_backslash + 1, str(i) + " ")
res = ''.join(res)
# rename file
os.rename(file, str(res))
i = i + 1
print('done')
First print statement prints 0, which means that my playlist is empty. I tried with a lot of playlists and it simply doesn't work. I remember that I downloaded a lot of playlists some time ago but now it's not working. Maybe there was some change in YouTube backend? But as I know there is new version of the pytube library (pytube4, pytubeX) and I installed this version and it's still not working.
I don't have enough reputation to comment. So adding as an answer instead. This error has been fixed in the original pytube repository. Do a pip install directly from the repo and it should work.