提问人:MonadoMaster0 提问时间:11/1/2023 更新时间:11/1/2023 访问量:21
pyTube 下载的音乐不能在收割者中使用
pyTube downloaded music cannot be used in reaper
问:
我使用 pytube 下载我在 YouTube 上创建的播放列表。我尝试过的媒体播放器(经典媒体播放器,VLC 媒体播放器,Windows Media Player)可以播放所有文件,但由于某种原因,收割者无法导入它们。有谁知道为什么会这样?
这是我使用的代码
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)
我尝试安装 LAME、ffmpeg 和 VLC,但没有帮助。此外,我意识到我可以使用我从互联网上下载的任何其他音频文件。
答: 暂无答案
评论
id = curr.streams.get_audio_only()
仅供参考,您不应该调用某些东西或任何其他内置名称。id
curr.streams.filter(only_audio=True)
curr.streams.filter
curr
curr