DEV Community

alapha888
alapha888

Posted on

YouTube's timedtext endpoint returns empty bodies from datacenter IPs — what I measured, and the panel fallback that works


When I built a YouTube transcript export extension, the obvious data path was the timedtext endpoint: the watch page lists caption tracks, and timedtext serves them in json3, srv3, vtt and other formats. I measured it twice — once with curl, once inside a real browser — and both times it came back empty. Here is what I measured, and the fallback that actually works.

What curl showed

On a real video page (dQw4w9WgXcQ), the watch page's captionTracks listed 6 tracks, so subtitles exist for the video. Fetching timedtext in every format returned HTTP 200 with a 0-byte body. Repeated requests then started returning 429.

An empty body with a 200 status is the ambiguous case: it could be a curl artifact (missing cookies, wrong headers, no session), or the endpoint could really be refusing this client.

The same result inside a real browser

To settle it I ran the extension's own fetch inside headless Chrome 154 on the real watch page, same-origin, with the page's own session. json3 through srv3 all came back empty (fetch-failed / empty-srv3), with no challenge page shown. That rules out curl: the browser, logged into the same page a human would see, got nothing from timedtext either.

The remaining explanation is the egress IP. This machine sits behind a datacenter IP, and YouTube's bot mitigation answers timedtext with an empty 200 instead of an error. A real user on a residential IP should still get subtitles from timedtext — but an extension cannot rely on it, and cannot distinguish "this video has no subtitles" from "this IP is being throttled" from the response alone.

The fallback that works: read the transcript panel

The transcript panel, opened from the video description, renders the cues in the DOM. That path works from the same datacenter IP — but the DOM changed, and the old selector silently returns zero rows.

The current render uses <transcript-segment-view-model>, with the timestamp in .ytwTranscriptSegmentViewModelTimestamp and the text in span[role="text"]. The old ytd-transcript-segment-renderer selector matches nothing on the current page.

The fix in my extension is a panelRows() that tries the new DOM first and falls back to the old one. Measured on the same video: 24 cues, 2,066 characters, and all four export formats built from those real cues — TXT 2,335 bytes, MD 2,668, SRT 3,142, VTT 3,162.

One honest limitation: the panel only gives the rows currently rendered (the first screen, 24 cues here), not the full transcript. timedtext is still the only full-length path, so the extension tries timedtext first and falls back to the panel — and tells the user to open the transcript panel when timedtext comes back empty.

Takeaway

If you are building against timedtext, test from the network your users are actually on. A 200 with an empty body is a throttling signal, not a missing-subtitles signal, and the panel DOM is the fallback — but check its selectors against the live page, because they move without notice.

The extension is currently in review on Edge Add-ons. Privacy policy: https://alapha888.github.io/yt-transcript-export-privacy/

Top comments (0)