neteaseapi

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// IsTest 是否测试环境
	IsTest = os.Getenv("IS_TEST")
)
View Source
var NetEaseAPIBaseURL = "http://netease-api:3335"

NetEaseAPIBaseURL 网易云API基础URL

View Source
var NetEaseGCtx = &NetEaseContext{}

NetEaseGCtx 网易云全局API调用封装

Functions

This section is empty.

Types

type GlobRecommendMusicRes

type GlobRecommendMusicRes struct {
	Result []struct {
		PicURL string `json:"picUrl"`
		Song   struct {
			Name    string `json:"name"`
			ID      int    `json:"id"`
			Artists []struct {
				Name string `json:"name"`
				ID   int    `json:"id"`
			} `json:"artists"`
		} `json:"song"`
	} `json:"result"`
}

GlobRecommendMusicRes 推荐音乐返回结果

type LoginStatusStruct added in v1.0.1

type LoginStatusStruct struct {
	Data struct {
		Code    int                    `json:"code"`
		Account map[string]interface{} `json:"account"`
		Profile map[string]interface{} `json:"profile"`
	} `json:"data"`
}

LoginStatusStruct 登录状态

type MusicInfo

type MusicInfo struct {
	ID   string
	URL  string
	Name string
}

MusicInfo 网易云音乐信息

type NetEaseContext

type NetEaseContext struct {
	// contains filtered or unexported fields
}

NetEaseContext 网易云API调用封装

func (*NetEaseContext) CheckIfLogin added in v1.0.1

func (ctx *NetEaseContext) CheckIfLogin() bool

CheckIfLogin 检查是否登陆

@receiver ctx
@return bool

func (*NetEaseContext) GetDailyRecommendID

func (ctx *NetEaseContext) GetDailyRecommendID() (musicIDs map[string]string, err error)

GetDailyRecommendID 获取当前账号日推

@receiver ctx
@return musicIDs
@return err

func (*NetEaseContext) GetMusicURLByID

func (ctx *NetEaseContext) GetMusicURLByID(IDName map[string]string) (InfoList []MusicInfo, err error)

GetMusicURLByID 依据ID获取URL/Name

@receiver ctx
@param IDName
@return InfoList
@return err

func (*NetEaseContext) GetNewRecommendMusic

func (ctx *NetEaseContext) GetNewRecommendMusic() (res []SearchMusicRes, err error)

GetNewRecommendMusic 获得新的推荐歌曲

@receiver ctx
@return res
@return err

func (*NetEaseContext) LoginNetEase

func (ctx *NetEaseContext) LoginNetEase() (err error)

LoginNetEase 获取登陆Cookie

@receiver ctx
@return err

func (*NetEaseContext) RefreshLogin added in v1.0.1

func (ctx *NetEaseContext) RefreshLogin() error

RefreshLogin 刷新登录

@receiver ctx
@return error

func (*NetEaseContext) SaveCookie added in v1.0.1

func (ctx *NetEaseContext) SaveCookie()

SaveCookie 保存Cookie

@receiver ctx

func (*NetEaseContext) SearchMusicByKeyWord

func (ctx *NetEaseContext) SearchMusicByKeyWord(keywords []string) (result []SearchMusicRes, err error)

SearchMusicByKeyWord 通过关键字搜索歌曲

@receiver ctx
@param keywords
@return result
@return err

func (*NetEaseContext) TryGetLastCookie added in v1.0.1

func (ctx *NetEaseContext) TryGetLastCookie()

TryGetLastCookie 获取初始化Cookie

@receiver ctx

type SearchMusicRes

type SearchMusicRes struct {
	ID         string
	Name       string
	ArtistName string
	SongURL    string
	PicURL     string
}

SearchMusicRes 搜索音乐返回结果

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL