Why your YouTube transcript scraper returns the wrong language (and how to fix it)
Description and use
YouTube scrapers frequently return captions in the wrong language, causing silent bugs in AI pipelines. The fix is to detect the original spoken language via auto‑generated speech recognition tracks and then select the best captions in that language, optionally using an Apify Actor for production.
Problem
Scrapers often return captions in the wrong language, causing silent bugs in AI pipelines that consume transcripts.
Outcome
By selecting the auto-generated speech recognition track to determine the original language and then choosing human-made captions in that language, the scraper now reliably returns correct-language transcripts, avoiding silent bugs in downstream AI tasks.
Workflow
- Identify if video is dubbed and read original audio track flag.
- Use language of auto-generated (speech recognition) track as reliable signal for spoken language.
- Select best captions in that language: prefer human-made, fall back to auto-generated if none.
- Handle cloud IP blocking by using residential proxies and retries.
- Optionally use Apify Actor for production deployment.
Evidence
9 of those 37 came back in the wrong language
The problem: YouTube's caption list is not ordered by the original language.
If you're using the open-source youtube-transcript-api library, step 2 looks roughly like this:
- Record date: 2026-10-16T16:40:59.854Z