How to Catch Exception in youtube-dl in python?
<p>I use youtube-dl in python, sometime I got ContentTooShortError, how can I use "try...catch..." in python to deal with these exceptions?</p>

<p>I use this code but it doesn't work</p>

<pre><code>with youtube_dl.YoutubeDL(options) as ydl:
    # youtube_url = video.youtube_url
    n = 0
    try:
        # 用设置成list的形式
        ydl.download([video.youtube_url])
    except 'ContentTooShortError':
        if n + 1 &lt; max_retey:
            ydl.download([video.youtube_url])
        else:
            return False
</code></pre>