Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	types/artistHomepage.go
#	types/musicianTasks.go
  • Loading branch information
XiaoMengXinX committed Jul 17, 2022
2 parents 8901f2f + 7dee5f5 commit 41d999f
Show file tree
Hide file tree
Showing 47 changed files with 338 additions and 58 deletions.
3 changes: 2 additions & 1 deletion api/Batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package api

import (
"encoding/json"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
"net/http"

"github.com/XiaoMengXinX/Music163Api-Go/utils"
)

// Batch 批处理 APi
Expand Down
1 change: 1 addition & 0 deletions api/Comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package api
import (
"encoding/json"
"fmt"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/Search.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/Upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package api
import (
"encoding/json"
"fmt"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/albumDetail.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
39 changes: 0 additions & 39 deletions api/artistDetail.go

This file was deleted.

40 changes: 40 additions & 0 deletions api/artistHomepage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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
}
1 change: 1 addition & 0 deletions api/circleGet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/cloudbeanNum.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/eventDelete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package api
import (
"encoding/json"
"fmt"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
3 changes: 2 additions & 1 deletion api/eventSend.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package api

import (
"encoding/json"
"strings"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
"github.com/google/uuid"
"strings"
)

// SendEventAPI 发送动态 API
Expand Down
1 change: 1 addition & 0 deletions api/loginStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/mlogSend.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package api
import (
"encoding/json"
"fmt"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/msgSend.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/musicianSign.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
28 changes: 23 additions & 5 deletions api/musicianTasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)

// MusicianTasksAPI 获取音乐人任务列表 API
const MusicianTasksAPI = "/api/nmusician/workbench/mission/cycle/list"
// MusicianTasksDailyAPI 获取音乐人每日任务 API
const MusicianTasksDailyAPI = "/api/nmusician/workbench/mission/cycle/list"

// MusicianTasksWeeklyAPI 获取音乐人周任务 API
const MusicianTasksWeeklyAPI = "/api/nmusician/workbench/mission/stage/list"

// GetMusicianTasks 获取音乐人任务列表
func GetMusicianTasks(data utils.RequestData) (result types.MusicianTasksData, err error) {
// GetMusicianDailyTasks 获取音乐人每日任务
func GetMusicianDailyTasks(data utils.RequestData) (result types.MusicianDailyTasksData, err error) {
var options utils.EapiOption
options.Path = MusicianTasksAPI
options.Path = MusicianTasksDailyAPI
options.Url = "https://music.163.com/eapi/nmusician/workbench/mission/cycle/list"
resBody, _, err := utils.ApiRequest(options, data)
if err != nil {
Expand All @@ -22,3 +26,17 @@ func GetMusicianTasks(data utils.RequestData) (result types.MusicianTasksData, e
result.RawJson = resBody
return result, err
}

// GetMusicianWeeklyTasks 获取音乐人周任务
func GetMusicianWeeklyTasks(data utils.RequestData) (result types.MusicianWeeklyTasksData, err error) {
var options utils.EapiOption
options.Path = MusicianTasksWeeklyAPI
options.Url = "https://music.163.com/eapi/nmusician/workbench/mission/stage/list"
resBody, _, err := utils.ApiRequest(options, data)
if err != nil {
return result, err
}
err = json.Unmarshal([]byte(resBody), &result)
result.RawJson = resBody
return result, err
}
3 changes: 2 additions & 1 deletion api/nosToken.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"crypto/md5"
"encoding/json"
"fmt"
"path"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
"path"
)

// NosTokenAPI 获取 NosToken API (用于文件上传)
Expand Down
1 change: 1 addition & 0 deletions api/obtainCloudbean.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/playlisTracks.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/playlistDelete.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
5 changes: 3 additions & 2 deletions api/playlistDetail.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package api
import (
"encoding/json"
"fmt"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand All @@ -12,7 +13,7 @@ const PlaylistDetailAPI = "/api/v6/playlist/detail"

// PlaylistDetailReq PlaylistDetail API 的 body json
type playlistDetailReq struct {
Id string `json:"id"`
ID string `json:"id"`
T string `json:"t"`
N string `json:"n"`
S string `json:"s"`
Expand All @@ -21,7 +22,7 @@ type playlistDetailReq struct {
// CreatePlaylistDetailReqJson 创建 获取歌单 请求json
func CreatePlaylistDetailReqJson(id int) string {
reqBody := playlistDetailReq{
Id: fmt.Sprintf("%d", id),
ID: fmt.Sprintf("%d", id),
T: "0",
N: "50",
S: "5",
Expand Down
1 change: 1 addition & 0 deletions api/playlistGet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/playlistNew.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
41 changes: 41 additions & 0 deletions api/programDetail.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package api

import (
"encoding/json"
"fmt"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)

// ProgramDetailAPI 节目详情API
const ProgramDetailAPI = `/api/dj/program/detail`

type programDetailReq struct {
ID string `json:"id"`
}

// CreateProgramDetailReqJson 创建获取节目详情请求json
func CreateProgramDetailReqJson(id int) string {
reqBody := programDetailReq{
ID: fmt.Sprintf("%d", id),
}
reqBodyJson, _ := json.Marshal(reqBody)
return string(reqBodyJson)
}

// GetProgramDetail 获取节目详情
func GetProgramDetail(data utils.RequestData, id int) (result types.ProgramDetailData, err error) {
var options utils.EapiOption
options.Path = ProgramDetailAPI
options.Url = "https://music.163.com/eapi/dj/program/detail"
reqBodyJson := CreateProgramDetailReqJson(id)
options.Json = reqBodyJson
resBody, _, err := utils.ApiRequest(options, data)
if err != nil {
return result, err
}
err = json.Unmarshal([]byte(resBody), &result)
result.RawJson = resBody
return result, err
}
3 changes: 2 additions & 1 deletion api/qrCheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package api

import (
"encoding/json"
"net/http"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
"net/http"
)

// QrLoginAPI 检查 QR 登录状态 API
Expand Down
1 change: 1 addition & 0 deletions api/qrUnikey.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/recommendSongs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
1 change: 1 addition & 0 deletions api/shortURL.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"encoding/json"

"github.com/XiaoMengXinX/Music163Api-Go/types"
"github.com/XiaoMengXinX/Music163Api-Go/utils"
)
Expand Down
Loading

0 comments on commit 41d999f

Please sign in to comment.