pytube 中的错误<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

问题描述 投票:0回答:4

代码:

from pytube import Playlist
playlist = Playlist('https://www.youtube.com/playlist?list=PLWPirh4EWFpEpO6NjjWLbKSCb-wx3hMql')

for video in playlist.videos:
    print("Video: ",video)
    video.streams.get_highest_resolution().download()

我收到错误:

python ssl youtube pytube
4个回答
4
投票

(适用于 OSX 用户) 换句话说...

  1. 转到您的应用程序文件夹并查找 Python 文件夹。我的显示“Python 3.11”
  2. 打开该目录,有一个名为“Install Certificates.command”的文件。
  3. 打开该文件,它将运行命令。

1
投票

转到 /Applications/Python3.x 并运行“安装证书.command”


1
投票
# Solved in 
# add
import ssl
ssl._create_default_https_context = ssl._create_stdlib_context

0
投票

谢谢@ghareeb fathy,成功了!

© www.soinside.com 2019 - 2024. All rights reserved.