youtube_dL 模块中是否有 'output' 选项?
Is there an 'output' option in the youtube_dL module?
假设我有如下脚本
import youtube_dl
ydl = youtube_dl.YoutubeDL(
{'format':'best',
'output':'C:/Users/my_profile/Desktop/%(title)s.%(ext)s'}
)
ydl.download(['Any Link'])
此处输出选项无效。我想知道是否有这样的选择!即使不是 output
我应该使用什么才能通过使用有点相似的代码获得所需的结果?
深入挖掘源代码,我在文件 options.py 中找到了命令行选项 -o
、--output
,它表明它已将其分配给 dest="outtmpl"
如果我在代码中使用这个 outtmpl
那么它就可以工作了
import youtube_dl
ydl = youtube_dl.YoutubeDL({
'format': 'best',
'outtmpl': '~/Desktop/%(title)s.%(ext)s'
})
ydl.download(['https://www.youtube.com/watch?v=KqmGZ_6LaUw'])
然后我得到文件 ~/Desktop/Kraftwerk - Neon Lights.mp4
因为我在 Linux 上测试过它所以我可以使用 ~
而不是 C:/Users/my_profile
但我不知道它是否适用于 Windows.
假设我有如下脚本
import youtube_dl
ydl = youtube_dl.YoutubeDL(
{'format':'best',
'output':'C:/Users/my_profile/Desktop/%(title)s.%(ext)s'}
)
ydl.download(['Any Link'])
此处输出选项无效。我想知道是否有这样的选择!即使不是 output
我应该使用什么才能通过使用有点相似的代码获得所需的结果?
深入挖掘源代码,我在文件 options.py 中找到了命令行选项 -o
、--output
,它表明它已将其分配给 dest="outtmpl"
如果我在代码中使用这个 outtmpl
那么它就可以工作了
import youtube_dl
ydl = youtube_dl.YoutubeDL({
'format': 'best',
'outtmpl': '~/Desktop/%(title)s.%(ext)s'
})
ydl.download(['https://www.youtube.com/watch?v=KqmGZ_6LaUw'])
然后我得到文件 ~/Desktop/Kraftwerk - Neon Lights.mp4
因为我在 Linux 上测试过它所以我可以使用 ~
而不是 C:/Users/my_profile
但我不知道它是否适用于 Windows.