Search code examples
pythonyoutubeyoutube-dl

Pass a parameter to 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)

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?


Solution

  • Option you need is ignoreerrors

    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.