Locale-agnostic synced-lyrics fetching library: NetEase and LRCLib providers, LRC parsing, credit-line filtering, on-disk fetch cache, and media-tag query building. Stdlib only, no runtime dependencies.
- NetEase search + lyric fetch, returns the full candidate list, not best-match-only
- LRCLib search with plain-text fallback when no synced lyrics exist
Candidatedataclass with lazy-parsed LRC lines- LRC parser fanning multi-timestamp lines out into one entry per timestamp
- Credit-line detection (
is_credit_line,classify_lines,filter_credit_lines) strips non-sung metadata: CJK and English role labels, provider watermarks, leftover LRC headers - Raw fetch cache as readable json under
LYRICS_DIR, one subdir per provider - Query building from container tags via ffprobe,
title artistpermutations
from lyrickit import fetch_from_providers, build_queries
queries, title, artists = build_queries("concert.mkv")
candidates = fetch_from_providers(queries[0], ["netease", "lrclib"])
lines = candidates[0].lines # [(seconds_or_None, text)]Single provider, bypassing cache:
from lyrickit import netease_candidates
candidates = netease_candidates("晴る ヨルシカ", fresh=True)Strip credits before display:
from lyrickit import filter_credit_lines
sung = filter_credit_lines(candidates[0].lines)| Setting | Default | Description |
|---|---|---|
LYRICS_DIR env var |
~/.cache/lyrickit |
Root for the fetch cache |
Cache layout: LYRICS_DIR/netease/<slug>.json stores query + candidates + lrcs; identical query reuses it, fresh=True refetches. Distinct queries can collide on slug, the stored query disambiguates (mismatch refetches, last one wins).
NetEase endpoints (search/pc, song/lyric) are adapted from the syncedlyrics netease provider, returning the full candidate list with per-candidate LRCs. A non-200 body (e.g. 405 rate limit) raises instead of caching an empty result. media_tags shells out to ffprobe once per file for title/artist/album/duration/embedded lyrics, degrading to {} when ffprobe is absent.
pip install -e .- syncedlyrics: NetEase endpoint + cookie approach