Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'verify' parameter to control SSL verification behavior #362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marcelodiaz558
Copy link

Description

This PR adds a new verify parameter to control SSL certificate verification, providing both API and CLI interfaces for this functionality. This offers a quick solution for common SSL-related issues that users have reported.

Problem Solved

This change provides an immediate solution for users experiencing SSL-related issues like:

Instead of requiring users to modify environment variables or implement complex workarounds, they can now directly control SSL verification behavior through both the API and CLI.

Changes

  • Added verify parameter to get_transcript(), get_transcripts(), and list_transcripts() methods
  • Added --verify option to CLI with support for both custom certificate paths and disabling verification
  • Added comprehensive test coverage for both API and CLI functionality
  • Added documentation in README.md with examples for both API and CLI usage
  • Default value is None to maintain backward compatibility
  • Parameter is passed through to the underlying requests session

The implementation follows the same pattern as Python requests' verify parameter, making it familiar to users who work with the requests library.

Usage

# API usage
from youtube_transcript_api import YouTubeTranscriptApi

# Using custom CA bundle
transcript = YouTubeTranscriptApi.get_transcript(video_id, verify='/path/to/cacert.pem')

# Disabling SSL verification (not recommended for production)
transcript = YouTubeTranscriptApi.get_transcript(video_id, verify=False)
# CLI usage
# Using custom certificate bundle
youtube_transcript_api video_id --verify /path/to/cacert.pem

# Disabling SSL verification
youtube_transcript_api video_id --verify False

@giltotherescue
Copy link

I just ran into this problem and would love to see this code merged

@psaks
Copy link

psaks commented Jan 30, 2025

I just ran into this problem and would love to see this code merged

Same here - this functionality is essential! However, in the meantime you can hack it by creating your own YouTubeTranscriptApi class (far from ideal, but it works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants