INNER CODE UNIT · Python
YouTubeTranscriptApi
jdepoix/youtube-transcript-api · youtube_transcript_api/_api.py:12
class YouTubeTranscriptApi:
def __init__(
self,
proxy_config: Optional[ProxyConfig] = None,
http_client: Optional[Session] = None,
):
"""
Note on thread-safety: As this class will initialize a `requests.Session`
object, it is not thread-safe. Make sure to initialize an instance of
`YouTubeTranscriptApi` per thread, if used in a multi-threading scenario!
:param proxy_config: an optional ProxyConfig object, defining proxies used for
all network requests. This can be used to work around your IP being blocked
by YouTube, as described in the "Working around IP bans" section of the
README
(https://github.com/jdepoix/youtube-transcript-api?tab=readme-ov-file#working-around-ip-bans-requestblocked-or-ipblocked-exception)
:param http_client: You can optionally pass in a requests.Session object, if you
manually want to share cookies between different instances of