以下のコードは公式サイトから持ってきたコードなのですが、これでやるとうまくダウンロードができません。どうしたら良いでしょうか。
Pythonのバージョンは 3.7.0です。
python
1コード 2 3from __future__ import unicode_literals 4import youtube_dl 5 6 7class MyLogger(object): 8 def debug(self, msg): 9 pass 10 11 def warning(self, msg): 12 pass 13 14 def error(self, msg): 15 print(msg) 16 17 18def my_hook(d): 19 if d['status'] == 'finished': 20 print('Done downloading, now converting ...') 21 22 23ydl_opts = { 24 'format': 'bestaudio/best', 25 'postprocessors': [{ 26 'key': 'FFmpegExtractAudio', 27 'preferredcodec': 'mp3', 28 'preferredquality': '192', 29 }], 30 'logger': MyLogger(), 31 'progress_hooks': [my_hook], 32} 33with youtube_dl.YoutubeDL(ydl_opts) as ydl: 34 ydl.download(['https://www.youtube.com/watch?v=BaW_jenozKc'])
このようなエラーが出てきます。
コード ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)> (caused by URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)')))
あなたの回答
tips
プレビュー