Fix: Update API endpoint and regex for token retrieval
Some checks failed
/ Build Windows (push) Has been cancelled

This commit is contained in:
itouakirai
2025-11-04 08:18:15 +08:00
committed by GitHub
parent 728dcb2f77
commit 3de085b9cc

View File

@@ -63,9 +63,9 @@ class WebAPI:
stop=stop_after_attempt(32))
def _set_token(self):
with httpx.Client() as client:
resp = client.get("https://beta.music.apple.com", follow_redirects=True)
index_js_uri = regex.findall(r"/assets/index-legacy-[^/]+\.js", resp.text)[0]
js_resp = client.get("https://beta.music.apple.com" + index_js_uri)
resp = client.get("https://music.apple.com", follow_redirects=True)
index_js_uri = regex.findall(r"/assets/index~[^/]+\.js", resp.text)[0]
js_resp = client.get("https://music.apple.com" + index_js_uri)
self.token = regex.search(r'eyJh([^"]*)', js_resp.text)[0]
# DO NOT REMOVE IT