Skip to main content
Podcast audio has no captions, so a podcast app that shows transcripts, writes show notes or searches inside episodes needs speech-to-text on every new episode. Doing that yourself means fetching each audio file, keeping a speech-to-text account, and tracking which episodes are done. This Node script reads the show’s RSS feed, sends each new episode’s audio link to Importly’s transcripts endpoint, and saves the text and timestamped segments in SQLite. Run it from cron, a scheduled worker or a platform’s cron job: each run collects the transcripts that finished and starts the episodes that are new. The same script in Python is Podcast feed transcripts in Python.

The code

transcribe-feed.mjs
Create your key on the API key page (it’s shown once) and keep it on the server.

How it works

The audio link comes from the feed. Each RSS <item> has an <enclosure> with the episode’s audio file in its url attribute. Importly takes direct media links like these, as well as episode pages on supported sites. The parser keeps attributes (ignoreAttributes: false), so the enclosure’s url and type come through as @_url and @_type. mode: 'ai' goes straight to speech-to-text. Podcast audio has no captions, so there’s nothing to check first. For a feed of videos that might have captions, send mode: 'auto' instead: captions cost $0.003 and speech-to-text only runs when there are none. maxCostDollars caps each episode. Speech-to-text is $0.01 per minute, so the default of $1.50 covers episodes up to 150 minutes. A longer episode fails with MAX_COST_EXCEEDED and isn’t charged. When the length isn’t known up front, the cap is held while the episode is transcribed and the unused part is refunded. Each episode is sent once. The episode’s <guid> is the key in SQLite, so a re-run skips everything already started, finished or failed. Unfinished jobs are picked up by the next run, so no run sits waiting on a long episode. Feeds list the newest episode first, so the first run starts the 10 newest and the back catalog follows 10 per run. Set language to the show’s language (a two-letter code like es). Without it, speech-to-text transcribes as English.

What gets stored

A finished job from GET /transcribe/status has the transcript under result. The script stores text, the segments as JSON, and costInDollars:
Segment times are in seconds, one segment per sentence, so you can link a search hit or a quote to the moment it was said.

Errors to handle

Every error has a documentationUrl with the fix. See Error handling.

In production

Use a webhook instead of polling. Pass a webhookUrl when you start each episode and save the transcript when Importly calls you back. Keep the status check as a fallback. See Webhooks. Running on a host without a persistent disk (serverless functions, most container platforms)? episodes.db is gone on the next deploy. Keep the same table in your app’s Postgres or another database; the queries don’t change. To hand each episode to a queue worker instead, see BullMQ. Many feeds? Loop over them in the same run. MAX_NEW_PER_RUN keeps a back catalog from starting hundreds of jobs at once, and a 429 just moves the rest to the next run. Want the audio file too? Send the episode to POST /import with includeTranscript: true and transcriptProvider: 'importly' and you get the file in your bucket and the transcript from one job. See Save to your bucket. Your own speech-to-text key? Add provider: 'deepgram' (or assemblyai, openai) and apiKey to pay $0.005 per minute plus your provider’s fees. An app that transcribes around the clock shouldn’t stop when credit runs out. Turn on auto top-up, or watch for the low-balance emails.
A 30-minute episode costs $0.30 with Importly speech-to-text, and status checks are free. Try it free, no card required. See Pricing & credits.