Fix: Update GetToken function for new Apple Music URL

This commit is contained in:
itouakirai
2025-11-04 07:56:54 +08:00
committed by GitHub
parent f430835e03
commit 84b56ecd4c

View File

@@ -7,7 +7,7 @@ import (
) )
func GetToken() (string, error) { func GetToken() (string, error) {
req, err := http.NewRequest("GET", "https://beta.music.apple.com", nil) req, err := http.NewRequest("GET", "https://music.apple.com", nil)
if err != nil { if err != nil {
return "", err return "", err
} }
@@ -23,10 +23,10 @@ func GetToken() (string, error) {
return "", err return "", err
} }
regex := regexp.MustCompile(`/assets/index-legacy-[^/]+\.js`) regex := regexp.MustCompile(`/assets/index~[^/]+\.js`)
indexJsUri := regex.FindString(string(body)) indexJsUri := regex.FindString(string(body))
req, err = http.NewRequest("GET", "https://beta.music.apple.com"+indexJsUri, nil) req, err = http.NewRequest("GET", "https://music.apple.com"+indexJsUri, nil)
if err != nil { if err != nil {
return "", err return "", err
} }
@@ -47,3 +47,4 @@ func GetToken() (string, error) {
return token, nil return token, nil
} }