Skip to content

SOCKS proxy via GenericProxyConfig fails with Missing dependencies for SOCKS support #603

Description

@luarss

To Reproduce

Steps to reproduce the behavior:

What code / cli command are you executing?

from youtube_transcript_api import YouTubeTranscriptApi
from youtube_transcript_api.proxies import GenericProxyConfig

api = YouTubeTranscriptApi(
    proxy_config=GenericProxyConfig(
        http_url="socks5://127.0.0.1:1080",
        https_url="socks5://127.0.0.1:1080",
    )
)
api.fetch("dQw4w9WgXcQ")

Which Python version are you using?

Python 3.13

Which version of youtube-transcript-api are you using?

youtube-transcript-api 1.2.4

Expected behavior

The request should succeed (or at least attempt to connect) through the SOCKS proxy.

Actual behaviour

Instead I received the following error message:

requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.

The library documents SOCKS proxy support in proxies.py (the docstring for GenericProxyConfig says it can set up "any generic HTTP/HTTPS/SOCKS proxy") and the README also mentions SOCKS proxies. But it doesn't work out of the box because PySocks is not listed as a dependency.

Root cause: requests (used internally in _api.py) delegates SOCKS proxying to urllib3.contrib.socks.SOCKSProxyManager, which requires PySocks. Without PySocks installed, requests raises InvalidSchema("Missing dependencies for SOCKS support.").

Workaround: pip install PySocks

Suggested fix: Either add PySocks as an optional dependency (e.g. youtube-transcript-api[socks]) or note in the docs that SOCKS proxies require installing PySocks separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions