A lot of apps want the same small feature: a user pastes a YouTube, TikTok or podcast link and gets the transcript back, to summarize it, search it or feed it to a model. It looks like an afternoon of work. Then it ships and the problems start.
The usual first version uses a captions library. It works on your laptop. Once it's deployed, two things go wrong. Requests from cloud servers (Vercel, AWS, a VPS) get blocked or asked to sign in, so the same code that worked locally returns errors in production. And plenty of videos have no captions at all, so you need a speech-to-text fallback, which means downloading the audio and calling a second service.
I built Importly for this, so this post uses it. It's an API: you send it a link and get back the transcript, the file or the metadata, and it works from servers. Below is the Next.js App Router version I'd ship, with the key kept on the server.
1.…