youtube-transcript-api errors

PoTokenRequired in youtube-transcript-api

Why youtube-transcript-api asks for a PO token on some videos even though captions show on YouTube, why cookies and proxies do not help, and what to do.

Running this on a server? TranscriptFetch returns the same transcript from any IP, no proxies. Try it free →

For some videos, YouTube now requires a proof-of-origin (PO) token on the caption request: a value YouTube's own player generates in the browser. The library cannot create one, so it stops with this error.

The error

text
youtube_transcript_api._errors.PoTokenRequired:
Could not retrieve a transcript for the video https://www.youtube.com/watch?v=VIDEO_ID! This is most likely caused by:

The requested video cannot be retrieved without a PO Token. If this happens, please open a GitHub issue!

What triggers it

In version 1.2.4 the library raises PoTokenRequired when the caption address YouTube hands out contains &exp=xpe, YouTube's marker for a caption request that needs the token. Without one, the caption request is answered with an empty response, so the library raises instead of returning nothing.

It is tracked in the library's issue #592, which was reopened because the root cause is unresolved. The reporter notes that captions show normally in YouTube itself for these videos.

What it is not

  • Not an IP block. It is a requirement on the request itself, unlike RequestBlocked, so proxies do not help.
  • Not fixed by cookies. The token is generated at run time by YouTube's player code and added to the request, not stored in a cookie.

What you can do

1. Upgrade and watch the issue

bash
pip install --upgrade youtube-transcript-api

Workarounds for YouTube changes usually land in new releases. Follow issue #592 for this one.

2. Skip those videos

python
from youtube_transcript_api import PoTokenRequired, YouTubeTranscriptApi

try:
    transcript = YouTubeTranscriptApi().fetch(video_id)
except PoTokenRequired:
    transcript = None  # needs a token only a browser can mint

3. Generate tokens yourself (advanced)

Tokens can be produced by running YouTube's player in a real browser and capturing the value, but they expire and the method breaks whenever YouTube changes, so it means ongoing maintenance.

4. Use an API that does not depend on that request

TranscriptFetch (our product) does not stop at that caption request: when captions cannot be read it transcribes the audio with AI instead, at 1 credit per started 5 minutes of audio, charged only on delivery.

FAQ

Why do captions show on YouTube but not in the library?

YouTube's player generates the token in your browser. The library makes the same request without it, and YouTube answers with nothing.

Will retrying help?

Not for the same video while YouTube requires the token for it. Upgrade the library and retry after a new release.

Need transcripts that work from a server?

TranscriptFetch fetches YouTube, TikTok and Instagram transcripts from its own network, with AI transcription when a video has no captions. Free credits every month, no card.