What you get
One Slack message a morning, and only on mornings with something new. Shows with the newest episode come first. Each episode shows its date, its length, a link to the Apple page and a link to the audio file, and quotes the first line of its description. Past four per show, the rest are counted and linked. The audio links are what you hand to a transcription model if you want more than a digest.
Warning: This episode contains strong language.
Ben Ratliff, a music critic and avid runner, always ran in silence. Then he discovered how music opened up to him — while running. It changed his entire approach to criticism and listening. He calls it “running the …
In this special episode, we bring you highlights from three talks at the Midwest AI Summit. Heidi Porter explores how to build reliable AI-augmented workflows using the right tools, evaluations, and guardrails. Kevin …
Ankur Moitra, Steven Brunton and Alex Kontorovich are three mathematicians who can speak to this incredible moment in the history of mathematics, when AI solved some of its hardest problems: Navier-Stokes, the …
Built from a real run against three shows on 2 November 2026; two episodes per show shown here.
How it works
- GitHub ActionsStarts the job at 06:13 UTC.
- Apple Podcasts ScraperRuns on Apify: the shows you follow, only episodes newer than the last run, with audio URLs and durations.
- episodes_digest.pyGroups the rows per show and builds the message.
- SlackOne webhook post, retried while Slack is busy.
Three decisions carry the whole design:
- The actor keeps the state. With
onlyNewSinceLastRunit remembers the newest episode date per show, in a named key-value store in your Apify account, and returns only newer episodes next time. The script stores nothing, so it runs the same on GitHub Actions, cron or a serverless function. - Apple answers in one request per show. Apple's lookup returns a show's latest 200 episodes at once, so a digest over twenty shows is twenty small requests;
episodesAfter: "7d"keeps the first run to a week. - Money and time have ceilings. Every run starts with a spending cap and a timeout. The actor stops cleanly below the cap and says so in its
summaryrows.
Before you start
- An Apify account (the free plan is enough) and an API token from Console → Settings → API & Integrations.
- A Slack incoming webhook: create an app at api.slack.com/apps, turn on Incoming Webhooks and add one for your channel.
- Your shows as Apple Podcasts IDs or URLs. The ID is the number after
idin the show's URL on podcasts.apple.com. - To try it on your machine: Python 3.11+ and uv.
1Look at the data first
Before writing code, look at what comes back. This input asks for the two latest episodes and two reviews of one show, and tries an ID that does not exist, well inside the 25 free results every account gets each month:
{
"podcasts": ["1434243584", "99999999999"],
"includeEpisodes": true,
"maxEpisodesPerPodcast": 2,
"includeReviews": true,
"maxReviewsPerPodcast": 2
}One synchronous call runs the actor and saves the dataset:
API=https://api.apify.com/v2/actors/agentsgearbox~apple-podcasts-scraper
curl -s "$API/run-sync-get-dataset-items?maxTotalChargeUsd=0.05" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d @try-input.json -o sample.jsonThe rows come in five types. Here is one of each, trimmed to the fields that matter:
[
{
"type": "podcast",
"id": "1434243584",
"name": "Lex Fridman Podcast",
"publisher": "Lex Fridman",
"url": "https://podcasts.apple.com/us/podcast/lex-fridman-podcast/id1434243584?uo=4",
"feedUrl": "https://lexfridman.com/feed/podcast/",
"artwork": "https://is1-ssl.mzstatic.com/image/thumb/Podcasts211/v4/ea/4…",
"genres": [
"Technology",
"Podcasts",
"Science"
],
"primaryGenre": "Technology",
"episodeCount": 503,
"latestReleaseDate": "2026-10-26T22:52:00.000Z",
"explicit": false,
"contentRating": "Clean",
"country": "us",
"query": null,
"chart": null,
"chartPosition": null
},
{
"type": "episode",
"podcastId": "1434243584",
"podcastName": "Lex Fridman Podcast",
"id": "1000798266396",
"guid": "https://lexfridman.com/?p=7807",
"title": "#503 – AI Crisis in Math: Navier-Stokes, Riemann Hypothesis & Complexity Theory",
"description": "Ankur Moitra, Steven Brunton and Alex Kontorovich are three mathematicians who can speak to this incredible moment in the history of mathematics, when AI solved…",
"releaseDate": "2026-10-26T22:52:28.000Z",
"durationSeconds": 13360,
"audioUrl": "https://media.blubrry.com/takeituneasy/ins.blubrry.com/takeituneasy/lex_ai_math_ai_crisis.mp3",
"fileType": "mp3",
"url": "https://podcasts.apple.com/us/podcast/503-ai-crisis-in-math-navier-stokes-riemann-hypothesis/id1434243584?i=1000798266396&uo=4",
"seasonNumber": null,
"episodeNumber": null,
"episodeType": null,
"explicit": true,
"artwork": "https://is1-ssl.mzstatic.com/image/thumb/Podcasts211/v4/ea/42/d7/ea42d7b1-8d4e-dd97-da5d-c508756550ca/mza_16782152345430036863.jpg/600x600bb.jpg",
"source": "apple"
},
{
"type": "review",
"podcastId": "1434243584",
"country": "us",
"id": "14698942575",
"rating": 1,
"title": "Chatbot throughout the interview",
"text": "You have an actual expert in front of you and decide to repeatedly query a chatbot and read the answers instead? Are you kidding?…",
"author": "Pops Callahan",
"date": "2026-10-22T22:34:20.000Z",
"voteSum": 0,
"voteCount": 0,
"url": "https://itunes.apple.com/us/review?id=1434243584&type=Podcast"
},
{
"type": "summary",
"target": "1434243584",
"kind": "podcast",
"country": "us",
"status": "COMPLETE",
"podcastsFound": 1,
"podcasts": [
{
"id": "1434243584",
"name": "Lex Fridman Podcast",
"episodes": 2,
"reviews": 2,
"newestEpisodeAt": "2026-10-26T22:52:28.000Z",
"averageRating": 3,
"note": null
}
],
"stoppedBy": null,
"checkpointUsed": false
},
{
"type": "error",
"target": "99999999999",
"error": "Apple Podcasts has no podcast with ID 99999999999 in the us storefront."
}
]podcastis the show: publisher, feed URL, genres, how many episodes it has and when the latest came out.episodeis what the digest is made of:releaseDate,durationSeconds,audioUrlwith itsfileType, the Apple page and the description. WithepisodeSource: "rss"the rows come from the show's own feed instead and carry season and episode numbers.reviewis a listener review from the storefront you chose, with its rating; the digest leaves reviews off.summaryis free, one per input: how many shows were found and, per show, what was delivered and the newest episode date.erroris free too. An unknown ID comes back as a row, not as a failed run, so one bad entry never costs you the whole digest.
Apple's lookup returns at most 200 episodes per show and publishes no aggregate rating for podcasts. Neither matters for a digest, but if you want a show's full archive, set episodeSource to rss, and if you want ratings, turn reviews on and read the average the summary computes from them.
2The script
Save it as episodes_digest.py at the root of the repository that will run it, then change RUN_INPUT to your shows. The dependency is declared inline (PEP 723), so uv run episodes_digest.py needs no virtualenv and no requirements file.
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = ["apify-client>=3.3,<4"]
# ///
"""Post the new episodes of the podcasts you follow to Slack, with audio links.
Runs agentsgearbox/apple-podcasts-scraper on Apify. The actor remembers the newest
episode date per show in a key-value store in your Apify account, so each run returns
only episodes it has not returned before and this script keeps no state.
Schedule it once a morning.
Environment:
APIFY_TOKEN Apify API token (Console > Settings > API & Integrations)
SLACK_WEBHOOK_URL Slack incoming webhook
DRY_RUN=1 print the Slack messages instead of posting them
REPLAY_RUN_ID=... format an earlier run again instead of starting a new one
"""
import json
import os
import sys
import time
import urllib.error
import urllib.request
from collections import defaultdict
from datetime import timedelta
from decimal import Decimal
from apify_client import ApifyClient
ACTOR = "agentsgearbox/apple-podcasts-scraper"
RUN_INPUT = {
"podcasts": [ # Apple IDs or Apple Podcasts URLs of the shows you follow
"1434243584", # Lex Fridman Podcast
"https://podcasts.apple.com/us/podcast/the-daily/id1200361736",
"1406537385", # Practical AI
],
"countries": ["us"],
"includeEpisodes": True,
"episodeSource": "apple", # latest 200 per show in one request
"maxEpisodesPerPodcast": 10,
"episodesAfter": "7d", # first run or lost checkpoint: reach back a week at most
"includeReviews": False,
"onlyNewSinceLastRun": True,
"checkpointStoreName": "podcast-digest-shows", # one store per digest
}
MAX_CHARGE_USD = Decimal("0.50") # hard cap per run; a normal morning costs under a cent
SHOWN = 4 # episodes listed per show; the rest are counted and linked
CONSOLE = "https://console.apify.com"
def fetch(client):
"""Starts the actor and waits, or loads an earlier run. Returns run and rows."""
replay = os.environ.get("REPLAY_RUN_ID")
if replay:
run = client.run(replay).get()
else:
run = client.actor(ACTOR).call(
run_input=RUN_INPUT,
max_total_charge_usd=MAX_CHARGE_USD,
run_timeout=timedelta(minutes=15),
)
if run is None:
sys.exit(f"Run {replay} not found")
if run.status != "SUCCEEDED":
sys.exit(f"Actor run ended {run.status}: {run_url(run)}")
return run, list(client.dataset(run.default_dataset_id).iterate_items(clean=True))
def run_url(run):
return f"{CONSOLE}/actors/{run.act_id}/runs/{run.id}"
def build_messages(run, rows):
"""Turns dataset rows into Slack Block Kit messages; [] when there is nothing new."""
shows, problems, episodes = {}, [], defaultdict(list)
for row in rows:
if row.get("type") == "podcast":
shows[row["id"]] = row
elif row.get("type") == "episode":
episodes[row["podcastId"]].append(row)
elif row.get("type") == "summary":
problems += summary_problems(row)
elif row.get("type") == "error":
problems.append(f"{row.get('target')}: {row['error']}")
total = sum(len(group) for group in episodes.values())
if not total and not problems:
return []
hours = sum(e.get("durationSeconds") or 0 for g in episodes.values() for e in g) / 3600
noun = "episode" if total == 1 else "episodes"
headline = f"{total} new {noun}" + (f", {hours:.1f} hours of listening" if hours >= 0.5 else "")
header = [
{"type": "header", "text": {"type": "plain_text", "text": headline}},
context(f"Since the last digest · <{run_url(run)}|Apify run>"),
]
newest_first = sorted(episodes.items(), key=lambda item: max(e.get("releaseDate") or "" for e in item[1]), reverse=True)
sections = [show_blocks(shows.get(key, {}), group, run) for key, group in newest_first]
if problems: # a context block holds at most 10 elements
notes = [mrkdwn("⚠️ " + esc(clip(p, 280))) for p in problems[:10]]
sections.append([{"type": "context", "elements": notes}])
return pack(header, sections, fallback=headline)
def summary_problems(s):
if s.get("stoppedBy") == "chargeLimit":
yield f"{s.get('target')}: stopped at the ${MAX_CHARGE_USD} cap; raise MAX_CHARGE_USD"
if s.get("status") == "ERROR":
yield f"{s.get('target')}: lookup failed"
for p in s.get("podcasts") or []:
if p.get("note"):
yield f"{p.get('name')}: {p['note']}"
def show_blocks(show, group, run):
name = esc(show.get("name") or group[0].get("podcastName") or "?")
title = f"*{name}*"
if show.get("publisher"):
title += f" · {esc(show['publisher'])}"
blocks = [section(title)]
ordered = sorted(group, key=lambda e: e.get("releaseDate") or "", reverse=True)
blocks += [section(episode_text(e)) for e in ordered[:SHOWN]]
if len(group) > SHOWN:
dataset = f"{CONSOLE}/storage/datasets/{run.default_dataset_id}"
blocks.append(context(f"+{len(group) - SHOWN} more in the <{dataset}|run's dataset>"))
return blocks
def episode_text(e):
"""Title, when, how long, where to listen; the first sentence of the description as a quote."""
head = f"🎧 *{esc(clip(e.get('title') or '?', 110))}*"
facts = []
if e.get("releaseDate"):
facts.append(e["releaseDate"][:10])
if e.get("durationSeconds"):
m = round(e["durationSeconds"] / 60)
facts.append(f"{m // 60} h {m % 60:02d} min" if m >= 60 else f"{m} min")
links = [f"<{e['url']}|Apple>"] if e.get("url") else []
if e.get("audioUrl"):
links.append(f"<{e['audioUrl']}|audio {esc(e.get('fileType') or '')}>".replace(" >", ">"))
line = head + "\n" + " · ".join(facts + links)
first = (e.get("description") or "").strip().split("\n")[0]
if first:
line += f"\n>{esc(clip(first, 220))}"
return line
def pack(header, sections, fallback, limit=50):
"""Slack takes at most 50 blocks per message: split between shows, never inside."""
messages, blocks = [], list(header)
for part in sections:
if len(blocks) + len(part) > limit:
messages.append(blocks)
blocks = []
blocks += part
messages.append(blocks)
return [{"text": fallback, "blocks": b} for b in messages]
def post(webhook, message):
"""Posts one message. Retries rate limits, server errors and network failures."""
data = json.dumps(message).encode()
for attempt in range(4):
request = urllib.request.Request(
webhook, data=data, headers={"Content-Type": "application/json"}
)
try:
with urllib.request.urlopen(request, timeout=30):
return
except urllib.error.HTTPError as e:
if (e.code != 429 and e.code < 500) or attempt == 3:
reason = e.read().decode()[:200]
raise RuntimeError(f"Slack answered HTTP {e.code}: {reason}") from None
time.sleep(int(e.headers.get("Retry-After") or 2**attempt))
except urllib.error.URLError as e:
if attempt == 3:
raise RuntimeError(f"Slack unreachable: {e.reason}") from None
time.sleep(2**attempt)
def section(text):
return {"type": "section", "text": mrkdwn(text)}
def context(text):
return {"type": "context", "elements": [mrkdwn(text)]}
def mrkdwn(text):
return {"type": "mrkdwn", "text": text}
def esc(text):
return str(text).replace("&", "&").replace("<", "<").replace(">", ">")
def clip(text, limit):
return text if len(text) <= limit else text[:limit].rsplit(" ", 1)[0] + " …"
def main():
token, webhook, dry_run = (os.environ.get(k) for k in
("APIFY_TOKEN", "SLACK_WEBHOOK_URL", "DRY_RUN"))
if not token or not (webhook or dry_run): # checked before paying for a run
sys.exit("Set APIFY_TOKEN and SLACK_WEBHOOK_URL (or DRY_RUN=1) first.")
run, rows = fetch(ApifyClient(token))
messages = build_messages(run, rows)
print(f"run {run.id}: {len(rows)} rows, {len(messages)} message(s)", file=sys.stderr)
if dry_run:
print(json.dumps(messages, indent=2, ensure_ascii=False))
return
for message in messages:
try:
post(webhook, message)
except RuntimeError as e:
sys.exit(f"{e}\nNothing was skipped: REPLAY_RUN_ID={run.id} uv run episodes_digest.py")
if __name__ == "__main__":
main()The parts worth a second look
Starting the run. call() starts the actor and blocks until it finishes. The spending cap and the run timeout bound the worst case. Any status other than SUCCEEDED exits non-zero with a link to the run, so the scheduler marks the job failed and GitHub emails you.
def fetch(client):
"""Starts the actor and waits, or loads an earlier run. Returns run and rows."""
replay = os.environ.get("REPLAY_RUN_ID")
if replay:
run = client.run(replay).get()
else:
run = client.actor(ACTOR).call(
run_input=RUN_INPUT,
max_total_charge_usd=MAX_CHARGE_USD,
run_timeout=timedelta(minutes=15),
)
if run is None:
sys.exit(f"Run {replay} not found")
if run.status != "SUCCEEDED":
sys.exit(f"Actor run ended {run.status}: {run_url(run)}")
return run, list(client.dataset(run.default_dataset_id).iterate_items(clean=True))Grouping. One group per show, the show with the newest episode first. The header line names the publisher from the podcast row; each episode line turns seconds into hours and minutes and carries both links. The headline adds up the listening time, which is the number that tells you whether to skip a morning.
def show_blocks(show, group, run):
name = esc(show.get("name") or group[0].get("podcastName") or "?")
title = f"*{name}*"
if show.get("publisher"):
title += f" · {esc(show['publisher'])}"
blocks = [section(title)]
ordered = sorted(group, key=lambda e: e.get("releaseDate") or "", reverse=True)
blocks += [section(episode_text(e)) for e in ordered[:SHOWN]]
if len(group) > SHOWN:
dataset = f"{CONSOLE}/storage/datasets/{run.default_dataset_id}"
blocks.append(context(f"+{len(group) - SHOWN} more in the <{dataset}|run's dataset>"))
return blocks
def episode_text(e):
"""Title, when, how long, where to listen; the first sentence of the description as a quote."""
head = f"🎧 *{esc(clip(e.get('title') or '?', 110))}*"
facts = []
if e.get("releaseDate"):
facts.append(e["releaseDate"][:10])
if e.get("durationSeconds"):
m = round(e["durationSeconds"] / 60)
facts.append(f"{m // 60} h {m % 60:02d} min" if m >= 60 else f"{m} min")
links = [f"<{e['url']}|Apple>"] if e.get("url") else []
if e.get("audioUrl"):
links.append(f"<{e['audioUrl']}|audio {esc(e.get('fileType') or '')}>".replace(" >", ">"))
line = head + "\n" + " · ".join(facts + links)
first = (e.get("description") or "").strip().split("\n")[0]
if first:
line += f"\n>{esc(clip(first, 220))}"
return linePosting. Slack takes at most 50 blocks per message and 3,000 characters per section, so titles and descriptions are clipped, four episodes are shown per show, and a long digest is split between shows, never inside one. Rate limits, server errors and network failures are retried with the delay Slack asks for; anything else fails the job at once, with the run's ID in the error.
def post(webhook, message):
"""Posts one message. Retries rate limits, server errors and network failures."""
data = json.dumps(message).encode()
for attempt in range(4):
request = urllib.request.Request(
webhook, data=data, headers={"Content-Type": "application/json"}
)
try:
with urllib.request.urlopen(request, timeout=30):
return
except urllib.error.HTTPError as e:
if (e.code != 429 and e.code < 500) or attempt == 3:
reason = e.read().decode()[:200]
raise RuntimeError(f"Slack answered HTTP {e.code}: {reason}") from None
time.sleep(int(e.headers.get("Retry-After") or 2**attempt))
except urllib.error.URLError as e:
if attempt == 3:
raise RuntimeError(f"Slack unreachable: {e.reason}") from None
time.sleep(2**attempt)3Run it on your machine
export APIFY_TOKEN=apify_api_... # Console > Settings > API & Integrations
DRY_RUN=1 uv run episodes_digest.py > messages.json # real run, nothing postedThe dry run prints the messages to messages.json and the run's ID to the terminal, and posts nothing. Paste one message into Slack's Block Kit Builder to see it rendered.
It is still a real run, so it moves the checkpoint forward: running again would find nothing new. To post exactly what you just inspected, replay that run instead:
export SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
REPLAY_RUN_ID=<run id from the dry run> uv run episodes_digest.py # posts that run's episodesThe checkpoint moves when the run completes, before Slack sees anything. If Slack is down, the job fails, and its log prints the exact REPLAY_RUN_ID=… command that posts the same run later. The rows stay in the run's dataset in your Apify account for your plan's retention period, so no episode is lost.
4Schedule it
Put the workflow next to the script:
name: Podcast digest
on:
schedule:
- cron: "13 6 * * *" # 06:13 UTC daily, off the busy full hour
workflow_dispatch: # the "Run workflow" button, for tests
# Two overlapping runs would read one checkpoint and post the same episodes twice.
concurrency: podcast-digest
jobs:
digest:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10
- run: uv run episodes_digest.py
env:
APIFY_TOKEN: ${{ secrets.APIFY_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}Add the two secrets and start a first run without waiting for tomorrow:
gh secret set APIFY_TOKEN # paste the token when asked
gh secret set SLACK_WEBHOOK_URL
gh workflow run "Podcast digest" # first digest now instead of tomorrow morning- 06:13, not 06:00. GitHub delays scheduled jobs at the top of the hour, when most of them start.
concurrencykeeps two runs from overlapping. Two runs would read the same checkpoint and post the same episodes twice.- Public repositories: GitHub disables scheduled workflows after 60 days without activity in a public repository. Keep the job in a private one, or re-enable it when GitHub emails you.
What it costs
You pay per row the actor returns: a podcast row per show per run and an episode row per new episode. Summaries and errors are free, and the first 25 results each month are free for every account. For twenty shows that release about three episodes a week each:
| Rows per month | Count | Price | Per month |
|---|---|---|---|
| Podcast rows, twenty shows, daily | 600 | $0.0018 | $1.08 |
| New episodes | ≈ 260 | $0.0006 | $0.16 |
| First 25 results of the month | free | −$0.04 | |
| Total | ≈ $1.20 |
Most of that is the daily podcast row per show. Running the digest three mornings a week instead of seven brings twenty shows to about forty cents a month; GitHub Actions needs a minute a day, inside the free minutes of any plan. Paid Apify plans pay less per row, up to 40% less on Gold.
Running it for real
- A capped run re-sends rather than skips. When the spending cap stops a run, the actor marks the show
PARTIALand leaves its checkpoint where it was. The next run walks from the old checkpoint again: you may see an episode twice, but you never miss one. - Shows that post many episodes a day. News shows can release several episodes between two digests;
maxEpisodesPerPodcastkeeps each show bounded, and the digest counts and links the rest. - Apple paces lookups. About twenty requests a minute per address; the actor waits accordingly, so a hundred shows take five minutes rather than five seconds.
- One checkpoint store per digest. Two digests sharing a
checkpointStoreNamewould split each other's episodes.
Variations
- Transcripts and summaries: feed
audioUrlto a speech-to-text model and the description to an LLM in the same script; the links are already in the rows. - Discord or Microsoft Teams:
build_messages()andpost()are the only Slack-specific parts; swap them for the other webhook format. - Charts instead of a watchlist: replace
podcastswith"charts": ["top"]and a country to follow whatever is in the top 50. - Several teams: run the script once per watchlist, each with its own
checkpointStoreNameand webhook.
Troubleshooting
Nothing gets posted
Either no show released anything (the log says so) or the checkpoint is further ahead than you expect, for example after a dry run. To start over, delete the key-value store named in checkpointStoreName under Storage → Key-value stores in the Apify Console.
"no podcast with ID …"
The ID is wrong. Open the show on podcasts.apple.com and copy the number after id in the URL, or paste the whole URL.
Slack answered HTTP 403, 404 or 410
The response names the reason: a revoked or mistyped webhook (invalid_token, no_service) or an archived channel (channel_is_archived). Create a new webhook, update the secret, then replay the failed run.
"stopped at the $0.50 cap"
The shows released more than the cap allows in one run, usually on the first run. Raise MAX_CHARGE_USD or lower maxEpisodesPerPodcast; nothing was skipped, the next run continues from the old checkpoint.