【问题标题】:how to set directory in ydl_opts in using youtube-dl in python?如何在 python 中使用 youtube-dl 在 ydl_opts 中设置目录?
【发布时间】:2016-06-09 04:46:09
【问题描述】:
**

我需要添加什么来指定所有下载的mp3都会到这个目录:e:/python/downloadedsongs

ydl_opts = {
    'format': 'bestaudio/best',
    'download_archive': 'downloaded_songs.txt',
    'outtmpl': '%(title)s.%(ext)s',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
        }],
    'logger': MyLogger(),
    'progress_hooks': [my_hook],

}

如果我理解正确的话,outtmpl 是输出文件名的模板。 **

【问题讨论】:

    标签: python-2.7 youtube-api youtube-dl


    【解决方案1】:

    outtmpl可以包含目录名,简单设置

    'outtmpl': 'e:/python/downloadedsongs/%(title)s.%(ext)s',
    

    【讨论】:

    • 如何指定用户名和密码?
    • @PrashantBhanarkar 这是一个单独的问题。随意在stackoverflow上提问!请务必事先查看list of available options
    猜你喜欢
    • 2013-08-05
    • 2015-12-05
    • 2017-12-05
    • 2020-04-18
    • 2014-07-06
    • 2020-09-05
    • 1970-01-01
    • 2021-03-02
    相关资源
    最近更新 更多