--- name: podcast-audio-url description: Resolve a podcast URL (Apple Podcasts episode/show page, or an already-direct audio link) to the direct audio file URL plus its normalized content type. Use when the user pastes a podcasts.apple.com link and the audio file is needed — e.g. before downloading, transcribing, or summarizing an episode (pairs with the podcast-bluf-summary skill). license: MIT metadata: author: frytg agent: pi category: media --- # Podcast audio URL extraction Turn a human-facing podcast page URL into the direct audio file URL. Apple Podcasts pages are the main case — the audio URL is buried in embedded JSON, not in an obvious tag. ## Input A podcast URL. Handle these cases: 1. `https://podcasts.apple.com/...` — extract from embedded schema data (below). 2. Anything already ending in an audio extension (`.mp3`, `.m4a`, `.mp4`, `.aac`, `.wav`, `.ogg`, `.flac`) — use as-is. 3. Anything else — treat as a direct audio URL candidate and verify with the HEAD request below. If the HEAD returns HTML, stop and ask the user for an RSS feed or episode link instead of guessing. ## Apple Podcasts extraction Episode URLs are preferred (they contain `?i=`). Show URLs work but resolve to whatever episode the page promotes first. Fetch the page HTML with a browser user agent: ```bash curl -sL -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0 Safari/537.36" "" ``` The page embeds JSON in a `