From cf7651ae847b93916a4b71044613617992561031 Mon Sep 17 00:00:00 2001 From: Uyanide Date: Tue, 31 Mar 2026 03:32:36 +0200 Subject: [PATCH] fix: request param and header of sp fetcher --- README.md | 1 + lrcfetch/fetchers/spotify.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5876e98..2a38f75 100644 --- a/README.md +++ b/README.md @@ -66,5 +66,6 @@ lrcfetch --install-completion - [lrclib.net](https://lrclib.net) - [spotify-lyrics-api](https://github.com/akashrchandran/spotify-lyrics-api) +- [librelyrics-spotify](https://github.com/libre-lyrics/librelyrics-spotify) - [NeteaseCloudMusicAPI](https://www.npmjs.com/package/NeteaseCloudMusicApi?activeTab=readme) - [qq-music-api](https://github.com/tooplick/qq-music-api) diff --git a/lrcfetch/fetchers/spotify.py b/lrcfetch/fetchers/spotify.py index 935341e..7ca90e7 100644 --- a/lrcfetch/fetchers/spotify.py +++ b/lrcfetch/fetchers/spotify.py @@ -190,6 +190,7 @@ class SpotifyFetcher(BaseFetcher): headers = { "User-Agent": UA_BROWSER, "Cookie": f"sp_dc={SPOTIFY_SP_DC}", + "Accept": "application/json", } with httpx.Client(headers=headers) as client: @@ -206,11 +207,11 @@ class SpotifyFetcher(BaseFetcher): logger.debug(f"Spotify: generated TOTP v{version}: {totp}") params = { - "reason": "transport", + "reason": "init", "productType": "web-player", "totp": totp, "totpVer": str(version), - "ts": str(int(time.time())), + "totpServer": totp, } try: @@ -286,11 +287,12 @@ class SpotifyFetcher(BaseFetcher): logger.error("Spotify: cannot fetch lyrics without a token") return LyricResult(status=CacheStatus.NETWORK_ERROR, ttl=TTL_NETWORK_ERROR) - url = f"{SPOTIFY_LYRICS_URL}{track.trackid}?format=json&market=from_token" + url = f"{SPOTIFY_LYRICS_URL}{track.trackid}?format=json&vocalRemoval=false&market=from_token" headers = { "User-Agent": UA_BROWSER, "Authorization": f"Bearer {token}", "App-Platform": "WebPlayer", + "Accept": "application/json", } try: