DEV Community

Aurelix Solutions
Aurelix Solutions

Posted on

Podcast transcripts from an RSS feed in Python, billed per minute

Most podcasts publish their audio in a plain RSS feed: every episode has an <enclosure> with a public MP3 link, a title, a date and show notes. So a podcast transcript is two steps: read the feed, then run speech recognition on the audio. Open-source Whisper does the second step well on clear speech, and it runs on a CPU.

This post pulls podcast transcripts in Python, from a feed, an Apple Podcasts link or a single file, and builds a daily feed of new episodes.

Disclosure: I'm Aurelix, and I built the Podcast Transcript API & Audio to Text tool. It's a paid tool (prices below).

What each row holds

  • text, word_count and segments: every segment as {start, end, text} in seconds; with includeWordTimestamps each segment also lists its words, and includeSrt adds an SRT subtitle file.
  • language (detected per 2-minute chunk, so an English ad break does not flip a Spanish show) and language_probability.
  • The episode as the feed shows it: podcast_title, episode_title, published, description, image_url, audio_url, episode_guid.
  • duration_seconds, transcribed_seconds and minutes_charged, and a status: ok, partial (stopped at your minute cap, your maximum charge or the run timeout) or why there is no transcript. Rows without a transcript are not charged.

The newest episodes of a show

pip install apify-client
Enter fullscreen mode Exit fullscreen mode
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("aurelix/podcast-transcript-audio-to-text").call(run_input={
    "rssFeeds": ["https://feeds.npr.org/510289/podcast.xml"],
    "maxEpisodesPerFeed": 2,
    "maxMinutesPerEpisode": 60,
})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(row["status"], row.get("episode_title"), row.get("minutes_charged"))
    print((row.get("text") or row.get("error"))[:300])
Enter fullscreen mode Exit fullscreen mode

An Apple Podcasts show or episode link works in the same field: it is resolved through Apple's public podcast lookup to the show's own feed. Direct audio or video links (MP3, M4A, WAV, MP4, WEBM) go in audioUrls.

A daily feed of new episodes

run_input = {
    "rssFeeds": ["https://feeds.npr.org/510289/podcast.xml"],
    "maxEpisodesPerFeed": 3,
    "incremental": True,
    "stateKey": "planet-money-daily",
}
Enter fullscreen mode Exit fullscreen mode

Save the input as a task in Apify Console and schedule it daily. Each run transcribes only episodes an earlier run did not return, so a quiet day costs only the start fee. Add a Slack incoming-webhook URL in slackWebhookUrl to get the new episodes in a channel.

Timestamps for quotes and citations

for s in row["segments"][:5]:
    print(f'{s["start"]:7.1f}-{s["end"]:7.1f}  {s["text"]}')
Enter fullscreen mode Exit fullscreen mode

Every segment carries its start and end, so a summary or an AI answer can point at the exact minute of the episode.

Limits

  • No speaker labels. One text with timestamps; who said what is not marked.
  • A small, fast model. Whisper base is good on clear podcast speech and weaker on accents, crosstalk and rare names.
  • Public audio only. No logins, paywalls or DRM; YouTube and TikTok links are not downloaded (captions for those come from separate tools).
  • Speed. About 4 to 5 minutes of audio per minute of run time at the default 2 GB; give long episodes a long enough run timeout. A run that hits the timeout saves the episode as partial and bills only the minutes done.

Cost

$4.50 per 1,000 audio minutes on every plan, cheaper than the leading tools, plus a small start fee per run. Each episode is billed for the seconds actually transcribed, rounded up to the next whole minute; a 42-minute episode is $0.19. Failed links, files without speech and episodes an earlier run already returned are free. Apify's free plan includes $5 of credit a month, about 1,100 audio minutes.

Links

Top comments (0)