I used pytube to donwload a playlist I created in YouTube. All files can be played by media players I tried (Classic Media Player, VLC Media Player, Windows Media Player), but for some reason reaper cannot import them. Does anyone have an idea why is this happening?
This was the code I used
from pytube import Playlist, YouTube
from pathlib import Path
actual = Path.cwd()
guerilla = Playlist("https://www.youtube.com/playlist?list=PL8ig_PduC0sKgSva6_tzdfZCkLp7jdAFF")
ext = "mp3"
def checkAuthor(yt):
if "-" not in yt.title:
try:
return yt.author.split(sep=" - ")[1]
except IndexError:
return yt.author
else: return ""
for index, music in enumerate(guerilla):
curr = YouTube(
music,
use_oauth=True,
allow_oauth_cache=True
)
id = curr.streams.get_audio_only()
Path.mkdir(filePath, exist_ok=True)
filePath = actual / "music"
name = str(index+1) + " " + checkAuthor(curr) + " - " + curr.title + "." + ext
completePath = filePath/name
curr.streams.filter(file_extension=ext)
toDown = curr.streams.get_by_itag(id.itag)
toDown.download(filePath,name, skip_existing=True)
I tried installing LAME, ffmpeg and VLC but none helped. Also I realized that I can use any other audiofiles I downloaded from the internet.