fix: request param and header of sp fetcher
This commit is contained in:
@@ -66,5 +66,6 @@ lrcfetch --install-completion
|
|||||||
|
|
||||||
- [lrclib.net](https://lrclib.net)
|
- [lrclib.net](https://lrclib.net)
|
||||||
- [spotify-lyrics-api](https://github.com/akashrchandran/spotify-lyrics-api)
|
- [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)
|
- [NeteaseCloudMusicAPI](https://www.npmjs.com/package/NeteaseCloudMusicApi?activeTab=readme)
|
||||||
- [qq-music-api](https://github.com/tooplick/qq-music-api)
|
- [qq-music-api](https://github.com/tooplick/qq-music-api)
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ class SpotifyFetcher(BaseFetcher):
|
|||||||
headers = {
|
headers = {
|
||||||
"User-Agent": UA_BROWSER,
|
"User-Agent": UA_BROWSER,
|
||||||
"Cookie": f"sp_dc={SPOTIFY_SP_DC}",
|
"Cookie": f"sp_dc={SPOTIFY_SP_DC}",
|
||||||
|
"Accept": "application/json",
|
||||||
}
|
}
|
||||||
|
|
||||||
with httpx.Client(headers=headers) as client:
|
with httpx.Client(headers=headers) as client:
|
||||||
@@ -206,11 +207,11 @@ class SpotifyFetcher(BaseFetcher):
|
|||||||
logger.debug(f"Spotify: generated TOTP v{version}: {totp}")
|
logger.debug(f"Spotify: generated TOTP v{version}: {totp}")
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"reason": "transport",
|
"reason": "init",
|
||||||
"productType": "web-player",
|
"productType": "web-player",
|
||||||
"totp": totp,
|
"totp": totp,
|
||||||
"totpVer": str(version),
|
"totpVer": str(version),
|
||||||
"ts": str(int(time.time())),
|
"totpServer": totp,
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -286,11 +287,12 @@ class SpotifyFetcher(BaseFetcher):
|
|||||||
logger.error("Spotify: cannot fetch lyrics without a token")
|
logger.error("Spotify: cannot fetch lyrics without a token")
|
||||||
return LyricResult(status=CacheStatus.NETWORK_ERROR, ttl=TTL_NETWORK_ERROR)
|
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 = {
|
headers = {
|
||||||
"User-Agent": UA_BROWSER,
|
"User-Agent": UA_BROWSER,
|
||||||
"Authorization": f"Bearer {token}",
|
"Authorization": f"Bearer {token}",
|
||||||
"App-Platform": "WebPlayer",
|
"App-Platform": "WebPlayer",
|
||||||
|
"Accept": "application/json",
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user