python - 如何避免 youtube-dl 中的 No-SSL-CERTIFICATE 错误?

标签 python python-3.x ssl ssl-certificate youtube-dl

import tkinter
import youtube_dl

ydl_opts = {
    'nocheckcertificate:': True
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['https://www.youtube.com/watch?v=C-u5WLJ9Yk4'])

print('done')

你好,通过执行上面的代码,我得到了

ERROR: Unable to download webpage: (caused by URLError(SSLError(1, '[SSL: CERTIFICAT

如何避免这个错误?我正在使用 pycharm3,它在我的 mac OS 终端上运行良好。

供您引用。 https://github.com/rg3/youtube-dl/blob/master/README.md#embedding-youtube-dl

最佳答案

冒号不是键的一部分,所以选项需要是

ydl_opts = {
    'nocheckcertificate': True,
} #                   ^^

你问题中的错误信息不完整,所以我无法判断原来的问题是什么。很可能,您使用的是一些过时或错误的 Python 发行版,既没有捆绑的根 CA,也没有正确的配置来使用操作系统的根 CA 存储。更新 pycharm3 可能会有所帮助。

关于python - 如何避免 youtube-dl 中的 No-SSL-CERTIFICATE 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49151287/

相关文章:

python - 如何从嵌入的字典/列表中提取所有值?

python - 给定一个表示二维分布的二维 Numpy 数组,如何借助 Numpy 或 Scipy 函数从该分布中采样数据?

python-3.x - 尝试加载 StanfordCoreNLP 时出现 psutil.AccessDenied 错误

python - 导入错误 : cannot import name requests

c++ - Swig、Python、C++ : TypeError: in method 'Geodatabase_Open' , 类型 'std::string' 的参数 2

python - 在 2 级列表中形成所有可能的字符串

python-3.x - 如何将存储在 GG Bigquery 中的数据导出到 GZ 文件中。

python - SSL 请求失败 - Python OSX

visual-studio - Visual Studio makecert DES3 证书

python - 将 LetsEncrypt/Certbot 与 Django 开发服务器一起使用?