migu

package
v0.0.0-...-69f4c14 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Client *ghttp.Client
}

func Client

func Client() *API

func New

func New(client *ghttp.Client) *API

func (*API) GetAlbum

func (a *API) GetAlbum(ctx context.Context, albumId string) (*api.Collection, error)

func (*API) GetAlbumRaw

func (a *API) GetAlbumRaw(ctx context.Context, albumId string) (*AlbumResponse, error)

获取专辑

func (*API) GetArtist

func (a *API) GetArtist(ctx context.Context, singerId string) (*api.Collection, error)

func (*API) GetArtistInfoRaw

func (a *API) GetArtistInfoRaw(ctx context.Context, singerId string) (*ArtistInfoResponse, error)

获取歌手信息

func (*API) GetArtistSongsRaw

func (a *API) GetArtistSongsRaw(ctx context.Context, singerId string, page int, pageSize int) (*ArtistSongsResponse, error)

获取歌手歌曲,page: 页码;pageSize: 每页数量

func (*API) GetPlaylist

func (a *API) GetPlaylist(ctx context.Context, playlistId string) (*api.Collection, error)

func (*API) GetPlaylistRaw

func (a *API) GetPlaylistRaw(ctx context.Context, playlistId string) (*PlaylistResponse, error)

获取歌单

func (*API) GetSong

func (a *API) GetSong(ctx context.Context, id string) (*api.Song, error)

func (*API) GetSongId

func (a *API) GetSongId(ctx context.Context, copyrightId string) (string, error)

func (*API) GetSongIdRaw

func (a *API) GetSongIdRaw(ctx context.Context, copyrightId string) (*SongIdResponse, error)

根据版权id获取歌曲id

func (*API) GetSongLyric

func (a *API) GetSongLyric(ctx context.Context, copyrightId string) (string, error)

func (*API) GetSongLyricRaw

func (a *API) GetSongLyricRaw(ctx context.Context, copyrightId string) (*SongLyricResponse, error)

获取歌词

func (*API) GetSongPic

func (a *API) GetSongPic(ctx context.Context, songId string) (string, error)

func (*API) GetSongPicRaw

func (a *API) GetSongPicRaw(ctx context.Context, songId string) (*SongPicResponse, error)

获取歌曲专辑封面

func (*API) GetSongRaw

func (a *API) GetSongRaw(ctx context.Context, songId string) (*SongResponse, error)

获取歌曲详情

func (*API) GetSongURL

func (a *API) GetSongURL(ctx context.Context, contentId, resourceType string) (string, error)

func (*API) GetSongURLRaw

func (a *API) GetSongURLRaw(ctx context.Context, contentId, resourceType string) (*SongURLResponse, error)

获取歌曲播放地址

func (*API) SearchSongs

func (a *API) SearchSongs(ctx context.Context, keyword string) ([]*api.Song, error)

func (*API) SearchSongsRawV1

func (a *API) SearchSongsRawV1(ctx context.Context, keyword string, page int, pageSize int) (*SearchSongsResponse, error)

搜索歌曲

func (*API) SearchSongsRawV2

func (a *API) SearchSongsRawV2(ctx context.Context, keyword string, page int, pageSize int) (ghttp.H, error)

搜索歌曲

func (*API) SendRequest

func (a *API) SendRequest(req *ghttp.Request) (*ghttp.Response, error)

type Album

type Album struct {
	ResourceType string    `json:"resourceType"`
	AlbumId      string    `json:"albumId"`
	Title        string    `json:"title"`
	ImgItems     []ImgItem `json:"imgItems"`
	SongItems    []*Song   `json:"songItems"`
}

type AlbumResponse

type AlbumResponse struct {
	CommonResponse
	Resource []Album `json:"resource"`
}

func (*AlbumResponse) String

func (a *AlbumResponse) String() string

type ArtistInfo

type ArtistInfo struct {
	ResourceType string    `json:"resourceType"`
	SingerId     string    `json:"singerId"`
	Singer       string    `json:"singer"`
	Imgs         []ImgItem `json:"imgs"`
}

type ArtistInfoResponse

type ArtistInfoResponse struct {
	CommonResponse
	Resource []ArtistInfo `json:"resource"`
}

func (*ArtistInfoResponse) String

func (a *ArtistInfoResponse) String() string

type ArtistSongsResponse

type ArtistSongsResponse struct {
	CommonResponse
	Data struct {
		ContentItemList []struct {
			ItemList []struct {
				Song Song `json:"song"`
			} `json:"itemList"`
		} `json:"contentItemList"`
	} `json:"data"`
}

func (*ArtistSongsResponse) String

func (a *ArtistSongsResponse) String() string

type CommonResponse

type CommonResponse struct {
	Code string `json:"code"`
	Info string `json:"info,omitempty"`
}

type ImgItem

type ImgItem struct {
	ImgSizeType string `json:"imgSizeType"`
	Img         string `json:"img"`
}

type Playlist

type Playlist struct {
	ResourceType string `json:"resourceType"`
	MusicListId  string `json:"musicListId"`
	Title        string `json:"title"`
	ImgItem      struct {
		Img string `json:"img"`
	} `json:"imgItem"`
	SongItems []*Song `json:"songItems"`
}

type PlaylistResponse

type PlaylistResponse struct {
	CommonResponse
	Resource []Playlist `json:"resource"`
}

func (*PlaylistResponse) String

func (p *PlaylistResponse) String() string

type SearchSongsResponse

type SearchSongsResponse struct {
	CommonResponse
	SongResultData struct {
		TotalCount string               `json:"totalCount"`
		Result     []*SearchSongsResult `json:"result"`
	} `json:"songResultData"`
}

func (*SearchSongsResponse) String

func (s *SearchSongsResponse) String() string

type SearchSongsResult

type SearchSongsResult struct {
	ResourceType string `json:"resourceType"`
	ContentId    string `json:"contentId"`
	CopyrightId  string `json:"copyrightId"`
	Id           string `json:"id"`
	Name         string `json:"name"`
	Singers      []struct {
		Id   string `json:"id"`
		Name string `json:"name"`
	} `json:"singers"`
	Albums []struct {
		Id   string `json:"id"`
		Name string `json:"name"`
	} `json:"albums"`
}

type Song

type Song struct {
	ResourceType string    `json:"resourceType"`
	ContentId    string    `json:"contentId"`
	CopyrightId  string    `json:"copyrightId"`
	SongId       string    `json:"songId"`
	SongName     string    `json:"songName"`
	SingerId     string    `json:"singerId"`
	Singer       string    `json:"singer"`
	AlbumId      string    `json:"albumId"`
	Album        string    `json:"album"`
	AlbumImgs    []ImgItem `json:"albumImgs"`
	LrcURL       string    `json:"lrcUrl"`
	PicURL       string    `json:"-"`
	Lyric        string    `json:"-"`
	URL          string    `json:"-"`
}

type SongIdResponse

type SongIdResponse struct {
	ReturnCode string `json:"returnCode"`
	Msg        string `json:"msg,omitempty"`
	Items      []struct {
		SongId string `json:"songId"`
	} `json:"items"`
}

func (*SongIdResponse) String

func (s *SongIdResponse) String() string

type SongLyricResponse

type SongLyricResponse struct {
	ReturnCode string `json:"returnCode"`
	Msg        string `json:"msg"`
	Lyric      string `json:"lyric"`
}

func (*SongLyricResponse) String

func (s *SongLyricResponse) String() string

type SongPicResponse

type SongPicResponse struct {
	ReturnCode string `json:"returnCode"`
	Msg        string `json:"msg"`
	SmallPic   string `json:"smallPic"`
	MediumPic  string `json:"mediumPic"`
	LargePic   string `json:"largePic"`
}

func (*SongPicResponse) String

func (s *SongPicResponse) String() string

type SongResponse

type SongResponse struct {
	CommonResponse
	Resource []*Song `json:"resource"`
}

func (*SongResponse) String

func (s *SongResponse) String() string

type SongURLResponse

type SongURLResponse struct {
	CommonResponse
	Data struct {
		URL string `json:"url"`
	} `json:"data"`
}

func (*SongURLResponse) String

func (s *SongURLResponse) String() string

Jump to

Keyboard shortcuts

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