-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b943ebb
commit a8d06ad
Showing
3 changed files
with
74 additions
and
63 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package api | ||
|
||
import ( | ||
"encoding/json" | ||
"github.com/XiaoMengXinX/Music163Api-Go/types" | ||
"github.com/XiaoMengXinX/Music163Api-Go/utils" | ||
) | ||
|
||
// ArtistHomepageAPI 获取歌手详情API | ||
const ArtistHomepageAPI = "/api/personal/home/page/artist" | ||
|
||
// ArtistHomepageReq 获取歌手详情API 的 body json | ||
type ArtistHomepageReq struct { | ||
ArtistId int64 `json:"artistId"` | ||
} | ||
|
||
// CreateArtistHomepageReqJson 创建获取歌手详情API 的 body json | ||
func CreateArtistHomepageReqJson(artistId int64) string { | ||
reqBody := ArtistHomepageReq{ | ||
ArtistId: artistId, | ||
} | ||
reqBodyJson, _ := json.Marshal(reqBody) | ||
return string(reqBodyJson) | ||
} | ||
|
||
// GetArtistHomepage 获取歌手详情 | ||
func GetArtistHomepage(data utils.RequestData, artistID int64) (result types.ArtistHomepageData, err error) { | ||
var options utils.EapiOption | ||
options.Path = ArtistHomepageAPI | ||
options.Url = "https://music.163.com/eapi/personal/home/page/artist" | ||
options.Json = CreateArtistHomepageReqJson(artistID) | ||
resBody, _, err := utils.ApiRequest(options, data) | ||
if err != nil { | ||
return result, err | ||
} | ||
err = json.Unmarshal([]byte(resBody), &result) | ||
result.RawJson = resBody | ||
return result, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters