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 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 or a scheduled worker: each run collects the transcripts that finished and starts the episodes that are new.

The code

transcribe_feed.py
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 a link to the episode’s audio file. Importly takes direct media links like these, as well as episode pages on supported sites. "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. 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. 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.
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.