Skip to content
Snippets Groups Projects
Commit 5060fa56 authored by Silvan's avatar Silvan
Browse files
parents e224a200 83c8933d
No related branches found
Tags 0.2.9
No related merge requests found
......@@ -4,6 +4,7 @@ import (
"encoding/base64"
"encoding/json"
"github.com/cnsilvan/UnblockNeteaseMusic/provider/base"
"html"
"log"
"net/http"
"net/url"
......@@ -60,8 +61,8 @@ func (m *KuWo) SearchSong(song common.SearchSong) (songs []*common.Song) {
}
if ok {
songResult := &common.Song{}
singerName, _ := kuWoSong["artist"].(string)
songName, _ := kuWoSong["name"].(string)
singerName := html.UnescapeString(kuWoSong["artist"].(string))
songName := html.UnescapeString(kuWoSong["name"].(string))
//musicSlice := strings.Split(musicrid, "_")
//musicId := musicSlice[len(musicSlice)-1]
songResult.PlatformUniqueKey = kuWoSong
......@@ -75,7 +76,7 @@ func (m *KuWo) SearchSong(song common.SearchSong) (songs []*common.Song) {
}
songResult.Name = songName
songResult.Artist = singerName
songResult.AlbumName, _ = kuWoSong["album"].(string)
songResult.AlbumName = html.UnescapeString(kuWoSong["album"].(string))
songResult.Artist = strings.ReplaceAll(singerName, " ", "")
songResult.MatchScore, ok = base.CalScore(song, songName, singerName, index, maxIndex)
if !ok {
......
......@@ -93,12 +93,15 @@ func PanicWrapper(f func()) {
}
func ToJson(object interface{}) string {
json, err := json.Marshal(object)
result := bytes.NewBuffer([]byte{})
jsonEncoder := json.NewEncoder(result)
jsonEncoder.SetEscapeHTML(false)
err := jsonEncoder.Encode(object)
if err != nil {
log.Println("ToJson Error:", err)
return "{}"
}
return string(json)
return result.String()
}
func Exists(keys []string, h map[string]interface{}) bool {
for _, key := range keys {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment