Música tiene una sección **Podcasts**: programas por categoría —Salud y fitness, Deporte, Comedia, Noticias, Historia, Crímenes reales, Ciencia, Tecnología, Sociedad y cultura, Negocios, Ficción, Educación, Música, Ocio— que suenan mientras entrenás y siguen donde los dejaste. Sin dependencias nuevas y sin clave de API: el directorio de Apple es público. **En español se comprueba, no se supone.** La tienda dice dónde se *vende* un podcast, no en qué idioma está —en el ranking español de comedia hay uno en catalán y en el argentino uno en inglés—, así que se lee el `<language>` del feed de cada programa (los primeros 64 KB, con una petición `Range`: el idioma está en las primeras líneas) y se descarta lo que no sea español. Un feed sin etiqueta se queda: feeds genuinamente españoles la omiten, y tirarlos por una omisión sería sacar podcasts buenos de la lista. La respuesta cuenta cuántos quedaron afuera y por qué (`skipped`), así que una lista corta nunca es un misterio, y abrir un programa en otro idioma se contesta con `spanish:false` en vez de con una lista vacía. Es la otra mitad de la radio y es lo contrario en todo lo que le importa al reproductor: un podcast es un **archivo** —tiene principio, final y un minuto en el que ibas—. Por eso hay un módulo de reglas puras (`lib/podcast-view.js`: dónde retomar, qué cuenta como escuchado, cuál sigue, cuántas posiciones se guardan) y por eso `lib/radio-player.js` pasa a ser `lib/player.js`: **un solo elemento de audio** para las dos cosas, que es lo que impide que una emisora y un episodio suenen a la vez. La barra crece línea de progreso, −15 s, +30 s, siguiente episodio y reloj; la posición se guarda por perfil (con tope de 200, lo más nuevo primero) en pausa, al parar, al terminar y cuando la app se va al fondo, porque con la pantalla bloqueada iOS suspende los temporizadores y un guardado sólo desde el tick perdería lo escuchado con el teléfono guardado. Media Session muestra episodio, programa y progreso en la pantalla bloqueada. Nada se descarga y nada pasa por el servidor: el episodio llega como la URL del `enclosure` y el audio va de quien lo publica al teléfono. Acá no hay lista blanca posible —un feed vive en cualquier host—, así que la puerta es **https, host real y nunca una dirección privada**, comprobada en la URL y en dónde terminó el pedido, con el cuerpo leído a tope y la conexión cortada al llegar: este contenedor vive adentro de una casa. Verificado con datos reales: 20 programas en español por categoría (idiomas es, es-ES, es-mx), un feed de 40 episodios parseado, un feed en inglés contestado como `spanish:false` y la dirección de metadatos rechazada con 400 sin hacer el pedido. Fuera de los podcasts: la página de la API ocultaba `health` y `music` enteras —el generador sólo dibuja las secciones de su tabla de etiquetas—, así que ahora están, con radio y podcasts incluidas.
6.2 KiB
Podcasts
Radio, but the other half of it: episodes, in Spanish, that you can resume.
Open Música → Podcasts, pick a category (Salud y fitness, Deporte, Comedia, Noticias, Historia, Crímenes reales, Ciencia, Tecnología, Sociedad y cultura, Negocios, Ficción, Educación, Música, Ocio), tap a show, tap an episode. It plays across screens, keeps going with the screen locked, and comes back where you left it.
Why podcasts and not just more radio
They are opposites in every way that matters to the player, and the difference is not cosmetic:
| Radio | A podcast | |
|---|---|---|
| Source | a live stream | a file with a beginning and an end |
| Position | meaningless | the feature |
| Pause | pause the stream | pause, resume, seek ±, remember |
| Playing next | the station's job | yours: next episode |
| Length | unknown, forever | minutes, and worth showing |
A podcast you cannot scrub is a podcast you do not use, which is why the player bar grows a progress hairline and two seek buttons when an episode is playing, and none of that exists for a station.
Spanish only — checked, not assumed
The user asked for Spanish, so the app checks, and this is the part worth knowing before trusting a short list:
- Apple's directory is browsed per storefront (
esandmx). A storefront says where a podcast is sold, which is not the same as the language it is in: the Spanish comedy chart carries a Catalan show, and the Argentine one carries an English show. - So every show's feed is read — its first 64 KB, with a
Rangerequest, because<language>is channel metadata that sits in the first ~1.5 KB and always before the first<item>— and its<language>decides.es,es-ES,es-419andspastay;ca,en,ptand the rest go. - A feed with no tag at all stays. Some genuinely Spanish feeds omit it (La Ruina does), and dropping them over an omission would quietly remove good podcasts; the storefront is the fallback signal, and it is not a guess.
- The response says how many shows were dropped and why (
skipped: { duplicate, language, unreadable, failed }), so a list of fifteen is never a mystery. - Opening a show re-checks against the whole feed, and a show in another language is answered with
spanish: falseand a sentence — not with an empty episode list that looks like a feed with nothing in it.
Nothing is proxied, and nothing is downloaded
An episode arrives as an https:// URL from the publisher's own enclosure, the phone plays it, and
the bytes go from the publisher to the phone. This server contributes the list, exactly the bargain
the radio makes — no audio through the container, no copies, no downloads, no disk.
What this does cost, server-side, is requests: Apple's charts and lookup (two per category), one
64 KB Range request per show to read its language, and one fetch per feed when a show is opened
(up to ~6 MB for a big archive — cached for half an hour, parsed, and the parsed episodes are what
is kept, never the body, because forty episodes are a few kilobytes and a feed is megabytes).
What may be fetched
Radio has a host allowlist because it talks to three services. Podcasts cannot: feeds live on every host in the world. So this is the other rule, and it is the rule that matters for an api container sitting inside somebody's house:
- https only, no credentials in the URL, a real hostname and never a private address — no
loopback, no
10./192.168./172.16-31., no carrier-grade NAT, no link-local (the169.254.169.254metadata address is the classic target), no IPv6 literals, no.localor.internal. - The URL is checked and so is where the request ended up, because a redirect is otherwise the way around it.
- Bodies are read with a cap and the connection is dropped the moment it is reached.
- Both routes need a session — not to protect public podcasts, but because this process fetches on behalf of whoever asks.
The player, and the two things that are easy to get wrong
- Audio only starts inside the tap. iOS allows audio to begin from a user gesture and from
nothing else, so nothing asynchronous may sit between the finger and the
play(): the episode URL is already in hand, and the store'splayEpisodecalls straight through. - The
<audio>element lives outside React (frontend/src/lib/player.js), shared with the radio, so changing screens does not stop it and two kinds of media can never play at once.
Positions are saved to your profile — per episode, throttled to once every few seconds, and always on pause, on stop, when an episode ends and when the app goes to the background. That last one matters: iOS suspends a locked page's timers, so a position saved only from a tick would lose whatever was played with the screen off.
Episodes count as heard when they are within twenty seconds of the end, and starting one of those begins it again rather than resuming into its last seconds. Two hundred positions are kept per profile, newest first.
The screen locked, and the native shells
Safari and the installed PWA keep playing with the phone locked, and Media Session puts the episode, the show and the progress bar on the lock screen, with the controls reaching the same audio element. The two shell builds need configuration for that (see MOBILE.md) — in the PWA, nothing.
What this deliberately is not
- Not a downloads app. There is no offline mode and no stored audio: the episode plays from the publisher every time, which is also why nothing here will ever be a copyright question.
- Not Apple Podcasts' API. There is no such thing for third parties; the directory and the feeds are public, and that is what this uses — no key, no account, no Apple ID.
- Not a proxy or a transcriber. No audio through the server, no speed-up, no ad-skipping.
- Not a general podcast directory. Spanish is a filter, not a preference to be toggled.
Credits
- Apple Podcasts directory — the charts and lookup used to find shows and their feeds. Public, keyless endpoints; the shows and episodes are the publishers' own.
- The shows themselves belong to the people who make them; the audio is served from their hosts.