Problem
retries_when_blocked never triggers IP rotation on the InnerTube POST endpoint because urllib3's Retry default allowed_methods excludes POST.
Read cite
youtube_transcript_api/_api.py:43-48:
retry_config = Retry(
total=proxy_config.retries_when_blocked,
status_forcelist=[429],
)
No allowed_methods set. urllib3 Retry.DEFAULT_ALLOWED_METHODS = {HEAD, GET, PUT, DELETE, OPTIONS, TRACE} — POST omitted.
youtube_transcript_api/_transcripts.py:446 issues self._http_client.post(INNERTUBE_API_URL...). When YouTube returns 429 on this POST, Retry skips it; connection is not closed, IP not rotated, IpBlocked raised on first hit.
Expected
With WebshareProxyConfig (default retries_when_blocked=10), a 429 on the InnerTube POST triggers up to 10 retries with fresh TCP connections (rotating IPs).
Actual
Single attempt, then IpBlocked. Only the GET /watch and GET /api/timedtext paths benefit from retries.
Fix sketch
retry_config = Retry(
total=proxy_config.retries_when_blocked,
status_forcelist=[429],
allowed_methods=frozenset({"HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE", "POST"}),
)
Environment
youtube-transcript-api 1.2.4 (pyproject.toml), requests *, Python 3.8-3.14.
Thanks for maintaining jdepoix/youtube-transcript-api!
Problem
retries_when_blockednever triggers IP rotation on the InnerTube POST endpoint because urllib3'sRetrydefaultallowed_methodsexcludes POST.Read cite
youtube_transcript_api/_api.py:43-48:No
allowed_methodsset. urllib3Retry.DEFAULT_ALLOWED_METHODS={HEAD, GET, PUT, DELETE, OPTIONS, TRACE}— POST omitted.youtube_transcript_api/_transcripts.py:446issuesself._http_client.post(INNERTUBE_API_URL...). When YouTube returns 429 on this POST,Retryskips it; connection is not closed, IP not rotated,IpBlockedraised on first hit.Expected
With
WebshareProxyConfig(defaultretries_when_blocked=10), a 429 on the InnerTube POST triggers up to 10 retries with fresh TCP connections (rotating IPs).Actual
Single attempt, then
IpBlocked. Only theGET /watchandGET /api/timedtextpaths benefit from retries.Fix sketch
Environment
youtube-transcript-api 1.2.4 (pyproject.toml), requests
*, Python 3.8-3.14.Thanks for maintaining jdepoix/youtube-transcript-api!