Skip to content

Commit

Permalink
新增沉浸环绕声支持
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoMengXinX committed Jun 14, 2023
1 parent d63d88f commit 9e070ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions api/songURL.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ const SongUrlAPI = "/api/song/enhance/player/url/v1"
type SongURLConfig struct {
// EncodeType 编码类型, 可选 "mp3", "aac"
EncodeType string
// Level 音质等级, 可选 "lossless", "higher", "standard", "hires", "jyeffect", "jymaster"
// Level 音质等级, 可选 "lossless", "higher", "standard", "hires", "jyeffect"(高清环绕声), "sky"(沉浸环绕声), "jymaster"(超清母带)
Level string
// Ids 歌曲 ID
Ids []int
}

// songUrlReq SongURL API 的 body json
type songUrlReq struct {
EncodeType string `json:"encodeType"`
Ids string `json:"ids"`
Level string `json:"level"`
EncodeType string `json:"encodeType"`
Ids string `json:"ids"`
Level string `json:"level"`
ImmerseType string `json:"immerseType,omitempty"`
}

// CreateSongURLJson 创建 获取歌曲试听URL 请求json
Expand All @@ -46,6 +47,9 @@ func CreateSongURLJson(config SongURLConfig) string {
EncodeType: config.EncodeType,
Level: config.Level,
}
if config.Level == "sky" {
reqBody.ImmerseType = "c51"
}
reqBodyJson, _ := json.Marshal(reqBody)
return string(reqBodyJson)
}
Expand Down
4 changes: 2 additions & 2 deletions utils/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ func CreateNewRequest(data string, url string, options RequestData) (answer stri
req.Header.Set(v.Name, v.Value)
}

cookie["appver"] = "8.9.70"
cookie["appver"] = "8.10.05"
cookie["buildver"] = strconv.FormatInt(time.Now().Unix(), 10)[0:10]
cookie["resolution"] = "1920x1080"
cookie["os"] = "android"
cookie["os"] = "Android"

_, ok := cookie["MUSIC_U"]
if !ok {
Expand Down

0 comments on commit 9e070ec

Please sign in to comment.