Skip to content

Make timestamps in transcripts clickable, use RSS transcripts#48

Merged
RobbieTheWagner merged 2 commits into
mainfrom
transcript-updates
Jul 24, 2026
Merged

Make timestamps in transcripts clickable, use RSS transcripts#48
RobbieTheWagner merged 2 commits into
mainfrom
transcript-updates

Conversation

@RobbieTheWagner

@RobbieTheWagner RobbieTheWagner commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added podcast RSS transcript fallback when no dedicated transcript is available.
    • Made transcript timestamps clickable in both RSS and markdown transcripts, enabling instant seeking.
    • Improved transcript handling across JSON, WebVTT, SRT, and plain text, with better enclosure selection.
  • Bug Fixes
    • Improved seek behavior reliability, including restoring playback state when seeking is blocked.
  • Documentation
    • Updated transcript generation/rendering documentation and dev notes.
  • Tests
    • Added end-to-end and unit coverage for transcript parsing, caching, timestamp seeking, and playback behavior.

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
starpod Ready Ready Preview, Comment Jul 24, 2026 3:38pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0792da21-c584-49d5-8abc-3d34d8294392

📥 Commits

Reviewing files that changed from the base of the PR and between 3857fb0 and 3e056cb.

📒 Files selected for processing (5)
  • src/components/Player.tsx
  • src/lib/rss.ts
  • src/lib/transcript.ts
  • tests/unit/rehype-transcript-timestamps.test.ts
  • tests/unit/transcript.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • tests/unit/transcript.test.ts
  • src/components/Player.tsx
  • src/lib/transcript.ts
  • src/lib/rss.ts

📝 Walkthrough

Walkthrough

Transcript support now reads RSS transcript metadata, parses fallback formats, renders clickable timestamps for RSS and markdown transcripts, and routes timestamp clicks through shared player state to seek and start episode playback. Tests cover parsing, transformation, fallback precedence, and playback.

Changes

Transcript playback

Layer / File(s) Summary
RSS transcript model and parsing
src/lib/rss.ts, src/lib/transcript.ts
RSS parsing selects transcript and audio entries; transcript utilities fetch, normalize, cache, and expose transcript paragraphs or text.
Transcript rendering and page fallback
src/lib/rehype-transcript-timestamps.mjs, astro.config.mjs, src/pages/[episode].astro, src/pages/[episode].html.md.ts
Episode pages prefer explicit markdown transcripts and fall back to RSS transcripts; markdown timestamps become seek buttons.
Timestamp seeking and playback
src/components/state.ts, src/components/episode/Transcript.tsx, src/components/episode/MarkdownTranscript.tsx, src/components/Player.tsx
Transcript clicks set shared episode and seek state, which the player applies after metadata loads and starts playback.
Transcript output validation and documentation
tests/unit/transcript.test.ts, tests/unit/rehype-transcript-timestamps.test.ts, tests/e2e/episode.spec.ts, CLAUDE.md
Tests cover parsing, caching, timestamp conversion, source precedence, and playback; documentation describes the transcript pipeline and plugin restart requirement.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant EpisodePage
  participant Transcript
  participant SharedState
  participant Player
  participant Audio
  EpisodePage->>Transcript: render RSS or markdown transcript
  Transcript->>SharedState: seekToEpisode(episode, seconds)
  SharedState-->>Player: publish seek target
  Player->>Audio: set currentTime after metadata loads
  Player->>Audio: start playback
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: clickable transcript timestamps and RSS transcript support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch transcript-updates

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/Player.tsx`:
- Around line 74-78: Update applySeek so player.play() is awaited before setting
isPlaying.value to true or clearing seekTo.value. Handle rejected playback by
resetting isPlaying.value and seekTo.value to their pre-seek state, preserving
the UI state when playback fails.

In `@src/lib/rss.ts`:
- Around line 153-156: Update the audio enclosure selection around
audioEnclosure to normalize each enclosure.type with toLowerCase() before
checking its audio MIME prefix, using the audio/ prefix. Preserve enclosures[0]
as the fallback when no audio enclosure matches.

In `@src/lib/transcript.ts`:
- Around line 109-112: Update the VTT fallback in the transcript parsing flow
around stripCues and splitParagraphs to preserve each cue’s start time. Parse
VTT cue blocks into paragraphs containing both the parsed start and cue text,
while retaining the existing plain-text/SRT fallback behavior where applicable,
so Transcript.tsx can render seek buttons.
- Around line 81-103: Update the JSON transcript parsing flow around the parsed
data and segment iteration to validate that the root value and every segment are
non-null objects before accessing fields. Retain only finite numeric start
values when constructing segments, while preserving valid text extraction and
existing fallback behavior for transcript text.
- Line 46: Validate the transcript URL before the fetch call in the
transcript-loading flow: require HTTPS, allow only configured trusted origins,
and reject URLs resolving to private or otherwise disallowed network ranges. Do
not call fetch for invalid or untrusted values from episode.transcriptUrl;
preserve the existing fetch behavior for approved URLs.

In `@tests/unit/rehype-transcript-timestamps.test.ts`:
- Around line 76-81: Add a test alongside the existing single-text-node case
that builds a paragraph with two sibling text nodes, each beginning or
containing a timestamp, then verifies both timestamps produce buttons with the
expected data-seek values. Use the existing run, buttonsIn, and timestamp
assertion pattern so the test exposes TIMESTAMP.test() state leaking across
sibling text nodes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f35cbbf6-894e-4804-b587-7e3481dbdd23

📥 Commits

Reviewing files that changed from the base of the PR and between 8c0de9f and 3857fb0.

📒 Files selected for processing (14)
  • CLAUDE.md
  • astro.config.mjs
  • src/components/Player.tsx
  • src/components/episode/MarkdownTranscript.tsx
  • src/components/episode/Transcript.tsx
  • src/components/state.ts
  • src/lib/rehype-transcript-timestamps.mjs
  • src/lib/rss.ts
  • src/lib/transcript.ts
  • src/pages/[episode].astro
  • src/pages/[episode].html.md.ts
  • tests/e2e/episode.spec.ts
  • tests/unit/rehype-transcript-timestamps.test.ts
  • tests/unit/transcript.test.ts

Comment thread src/components/Player.tsx Outdated
Comment thread src/lib/rss.ts
Comment thread src/lib/transcript.ts
let paragraphs: Array<TranscriptParagraph> | null = null;

try {
const response = await fetch(url);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the target file and nearby context.
ast-grep outline src/lib/transcript.ts --view expanded || true
echo '---'
wc -l src/lib/transcript.ts
echo '---'
cat -n src/lib/transcript.ts | sed -n '1,220p'
echo '---'
# Find where episode.transcriptUrl is set/used.
rg -n "transcriptUrl|fetch\\(url\\)|new URL\\(|private network|trusted-origin|HTTPS" src -S

Repository: shipshapecode/starpod

Length of output: 7995


🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline src/lib/transcript.ts --view expanded || true
echo '---'
wc -l src/lib/transcript.ts
echo '---'
cat -n src/lib/transcript.ts | sed -n '1,220p'
echo '---'
rg -n "transcriptUrl|fetch\\(url\\)|new URL\\(|private network|trusted-origin|HTTPS" src -S

Repository: shipshapecode/starpod

Length of output: 7995


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the transcript helper and surrounding call sites.
sed -n '1,220p' src/lib/transcript.ts
echo '---'
rg -n "transcriptUrl|transcript" src -S

Repository: shipshapecode/starpod

Length of output: 17431


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect how RSS transcript URLs are populated and whether any URL allowlisting exists.
cat -n src/lib/rss.ts | sed -n '1,240p'
echo '---'
rg -n "allowlist|allow-list|trusted|private network|private-network|localhost|127\\.0\\.0\\.1|::1|https://|new URL\\(.*transcript|transcriptType" src -S

Repository: shipshapecode/starpod

Length of output: 10667


Restrict feed-provided transcript URLs before fetching. episode.transcriptUrl comes straight from RSS metadata and is fetched directly during page generation, so a compromised feed can steer requests to arbitrary hosts. Enforce HTTPS and a trusted-origin/private-network allowlist before fetch().

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/transcript.ts` at line 46, Validate the transcript URL before the
fetch call in the transcript-loading flow: require HTTPS, allow only configured
trusted origins, and reject URLs resolving to private or otherwise disallowed
network ranges. Do not call fetch for invalid or untrusted values from
episode.transcriptUrl; preserve the existing fetch behavior for approved URLs.

Comment thread src/lib/transcript.ts
Comment on lines +81 to +103
if (lower.includes('json')) {
let data: JsonTranscript;
try {
data = JSON.parse(raw);
} catch {
return null;
}

if (Array.isArray(data.segments) && data.segments.length > 0) {
const segments: Array<{ text: string; start?: number }> = [];
for (const segment of data.segments) {
const text = segment.text?.trim();
if (text) {
segments.push({ text, start: segment.start });
}
}
if (segments.length > 0) {
return groupSegments(segments);
}
}

if (typeof data.text === 'string' && data.text.trim()) {
return splitParagraphs(data.text);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Guard parsed JSON before dereferencing transcript fields.

Valid JSON such as null, or segments: [null], throws at data.segments or segment.text outside the JSON.parse catch and can fail static page generation. Validate that the root and each segment are objects, and retain only finite numeric start values.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/transcript.ts` around lines 81 - 103, Update the JSON transcript
parsing flow around the parsed data and segment iteration to validate that the
root value and every segment are non-null objects before accessing fields.
Retain only finite numeric start values when constructing segments, while
preserving valid text extraction and existing fallback behavior for transcript
text.

Comment thread src/lib/transcript.ts Outdated
Comment thread tests/unit/rehype-transcript-timestamps.test.ts
@RobbieTheWagner
RobbieTheWagner merged commit de98da9 into main Jul 24, 2026
6 checks passed
@RobbieTheWagner
RobbieTheWagner deleted the transcript-updates branch July 24, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant