# LRCLIB lyrics fallback ## Sources consulted - [LRCLIB API documentation](https://lrclib.net/docs), consulted 2026-09-24. - AuraMusic [LrcLibLyricsProvider.kt](https://github.com/TeamAuraMusic/AuraMusic/blob/185a77d31733047de06cbec619d40731755a0ec1/app/src/main/kotlin/com/auramusic/app/lyrics/LrcLibLyricsProvider.kt) and [LrcLib.kt](https://github.com/TeamAuraMusic/AuraMusic/blob/185a77d31733047de06cbec619d40731755a0ec1/lrclib/src/main/kotlin/com/auramusic/lrclib/LrcLib.kt), commit `185a77d31733047de06cbec619d40731755a0ec1`. - [Metrolist lyrics provider comparison](metrolist-lyrics-reference.md), reviewed at commit `28fa8f042bfabb880bdecc0d9fa37e86cf72b90e`. ## Observed contract and local choices LRCLIB documents `GET /api/get` with required `track_name` and `artist_name`, optional `album_name` and duration in seconds. A successful response includes track metadata, optional `syncedLyrics` and `plainLyrics`, and an `instrumental` flag. A miss is HTTP 404; HTTP 429 supplies `Retry-After`. Duration matching is normally within two seconds. Hydraulophone first sends one exact-signature request to `https://lrclib.net/api/get`. It validates the returned title and artist, and also album and duration when supplied, before displaying words. If the exact result is absent or plain, it sends at most one `/api/search` request with title and artist only. Search candidates must match the complete normalized title and artist; known duration must be within two seconds. A different album is accepted only when that duration matches, to allow compilation releases, and a matching album is preferred among candidates. Timed text wins over plain text. There are no title-only searches or stripped version/remaster qualifiers. These are deliberate safeguards against showing lyrics for a different recording. A plain exact result survives search errors. Malformed LRC without plain lyrics is treated as unavailable. Unknown fields are ignored; malformed required metadata is a typed response error. The LRC parser accepts minute-second timestamps with one to three fractional digits, multiple timestamps on one line, and a global millisecond offset. It discards metadata and malformed cues, sorts cues by time, merges lines with the same timestamp, and leaves end times absent. `SongLyrics` derives the active line from the following cue when possible. The adapter has no disk cache and no request retry. It makes at most two requests per lookup, spaces them by at least 250 ms, and, after HTTP 429, blocks subsequent calls for the server's `Retry-After` interval (or 30 seconds if absent/invalid). Transport errors and non-404 HTTP failures remain errors if no plain exact result is available. The default ephemeral URLSession has eight-second request and twelve-second resource timeouts, disabled cookies and cache, and a delegate that refuses redirects. Responses over 512 KiB are rejected after download; search considers at most 50 returned candidates. ## Privacy, attribution, and update risk The request discloses the song title, artist, and, when known, album and duration to LRCLIB. It never includes a YouTube video ID, cookie, session header, or authorization value. The authentication gate stays in the domain-facing InnerTube service; this adapter is an isolated protocol component. The client identifies itself as `Hydraulophone/0.1`; before public release, add a verified project page or contact to that header to meet LRCLIB's documented identification rule. AuraMusic is a GPL-3.0 reference, not a runtime dependency. This is a clean-room Swift implementation of the documented LRCLIB response and LRC format, without copied Kotlin parsing or matching code. If LRCLIB changes the response or rate-limit rules, update this adapter and its fixture tests before broadening matching. Lyrics may have independent copyright restrictions; this feature displays fetched words transiently and does not save them.