gpt4 book ai didi

python - 适用于Linux的youtube_dl outtmpl格式

转载 作者:行者123 更新时间:2023-12-03 06:08:24 26 4
gpt4 key购买 nike

 queue_path = os.path.abspath(os.path.realpath("Queue") + f"\song{q_num}.%(ext)s")

ydl_opts = {
'format': 'bestaudio/best',
'quiet': True,
'outtmpl': queue_path,
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}

with youtube_dl.YoutubeDL(ydl_opts) as ydl:
print("Downloading audio now\n")
ydl.download([carmelSongs[query]])

该代码可以在Windows计算机上按预期方式工作,但该文件不会转到Linux计算机(使用heroku托管的云)中工作目录中的queue文件夹中。这是一个discord.py漫游器,其中许多代码来自我观看的youtube视频,在其中我对代码进行了调整以满足自己的需求。这是我的代码中我不完全理解的部分之一,因此,任何帮助将不胜感激!

我有一个没有返回任何东西的测试机制:

@client.command()
async def troubleshoot(ctx):
for item in os.listdir("Queue"):
print(item)

再次,任何帮助将不胜感激。
我非常确定这是主要问题,因为所有其他方面都可以正常工作。

最佳答案

多亏了@peeol,我能够更改脚本中的所有反斜杠以按照Linux标准转发斜杠。

关于python - 适用于Linux的youtube_dl outtmpl格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60713306/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com