Somnath Paul
Somnath Paul

Reputation: 19

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

Code:

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()

Error I am getting:

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

Upvotes: 0

Views: 7529

Answers (4)

Deepak Bansal
Deepak Bansal

Reputation: 66

Worked for me, You have to go to directory /Applications/Python3.x and then run sudo sh ./Install\ Certificates.command

Upvotes: 0

ghareeb fathy
ghareeb fathy

Reputation: 455

# Solved in 
# add
import ssl
ssl._create_default_https_context = ssl._create_stdlib_context

Upvotes: 2

JsohnData
JsohnData

Reputation: 51

(for OSX users) In another words...

  1. Go to your applications folder and look for Python folder. Mine says "Python 3.11"
  2. Open that directory, there is a file called "Install Certificates.command".
  3. Open that file and it will run the command.

Upvotes: 5

Stanislav Radevich
Stanislav Radevich

Reputation: 11

Go to /Applications/Python3.x and run 'Install Certificates.command'

Upvotes: 1

Related Questions