将参数传递给 youtube-dl [英] Pass a parameter to youtube-dl

查看:27
本文介绍了将参数传递给 youtube-dl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 --ignore-errors(link) 参数到我的 youtube-dl 对象,我似乎做对了.代码如下:

I want to pass the --ignore-errors(link) parameter to my youtube-dl object and i can't seem to be doing it right. Here's the code:

options = {
'format': 'bestaudio/best',
'ignore-errors': True,
'postprocessors': [{
    'key': 'FFmpegExtractAudio',
    'preferredcodec': 'mp3',
    'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(options) as youtube_object:
    meta = youtube_object.extract_info(link, download = False)

我正在尝试下载的播放列表中的一个视频给了我一个错误,我想忽略该视频(正是 cmd --ignore-error 的作用)但是我如何将其集成到脚本中?

One of the videos from the playlist i'm trying to download gives me an error and i should like to ignore that video(exactly what the cmd --ignore-error does) but how can i integrate it in a script?

推荐答案

您需要的选项是 忽略错误

Option you need is ignoreerrors

查看从命令行参数到代码内"的映射的最简单方法是查看 cli 规范.它基于内置 optparse 库,您正在寻找 dest 参数.

Easiest way to see mapping from command-line params to "in-code" is to look into cli spec. Its based on build-in optparse lib, and you're looking for dest argument.

这篇关于将参数传递给 youtube-dl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆