fix: sp
This commit is contained in:
@@ -46,6 +46,7 @@ SPOTIFY_SECRET_URL = (
|
|||||||
)
|
)
|
||||||
SPOTIFY_SP_DC = os.environ.get("SPOTIFY_SP_DC", "")
|
SPOTIFY_SP_DC = os.environ.get("SPOTIFY_SP_DC", "")
|
||||||
SPOTIFY_TOKEN_CACHE_FILE = os.path.join(CACHE_DIR, "spotify_token.json")
|
SPOTIFY_TOKEN_CACHE_FILE = os.path.join(CACHE_DIR, "spotify_token.json")
|
||||||
|
SPOTIFY_APP_VERSION = "1.2.87.284.g3ff41c13"
|
||||||
|
|
||||||
# Netease api
|
# Netease api
|
||||||
NETEASE_SEARCH_URL = "https://music.163.com/api/cloudsearch/pc"
|
NETEASE_SEARCH_URL = "https://music.163.com/api/cloudsearch/pc"
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ from .base import BaseFetcher
|
|||||||
from ..models import TrackMeta, LyricResult, CacheStatus
|
from ..models import TrackMeta, LyricResult, CacheStatus
|
||||||
from ..config import (
|
from ..config import (
|
||||||
HTTP_TIMEOUT,
|
HTTP_TIMEOUT,
|
||||||
|
SPOTIFY_APP_VERSION,
|
||||||
TTL_NOT_FOUND,
|
TTL_NOT_FOUND,
|
||||||
TTL_NETWORK_ERROR,
|
TTL_NETWORK_ERROR,
|
||||||
SPOTIFY_TOKEN_URL,
|
SPOTIFY_TOKEN_URL,
|
||||||
@@ -189,8 +190,9 @@ class SpotifyFetcher(BaseFetcher):
|
|||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
"User-Agent": UA_BROWSER,
|
"User-Agent": UA_BROWSER,
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Referer": "https://open.spotify.com/",
|
||||||
"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:
|
||||||
@@ -292,9 +294,12 @@ class SpotifyFetcher(BaseFetcher):
|
|||||||
url = f"{SPOTIFY_LYRICS_URL}{track.trackid}?format=json&vocalRemoval=false&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}",
|
|
||||||
"App-Platform": "WebPlayer",
|
|
||||||
"Accept": "application/json",
|
"Accept": "application/json",
|
||||||
|
"Authorization": f"Bearer {token}",
|
||||||
|
"Referer": "https://open.spotify.com/",
|
||||||
|
"App-Platform": "WebPlayer",
|
||||||
|
"Spotify-App-Version": SPOTIFY_APP_VERSION,
|
||||||
|
"Origin": "https://open.spotify.com",
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user