migu

package
v0.0.0-...-035f39c Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SearchAPI          = "https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/search_all.do?isCopyright=1&isCorrect=1"
	GetSongIdAPI       = "http://music.migu.cn/v3/api/music/audioPlayer/songs?type=1"
	GetSongInfo        = "https://app.c.nf.migu.cn/MIGUM2.0/v2.0/content/querySongBySongId.do?contentId=0"
	GetSongPlayInfoAPI = "https://app.c.nf.migu.cn/MIGUM2.0/v2.0/content/listen-url?copyrightId=0&netType=01&toneFlag=HQ"
	GetSongLyricAPI    = "http://music.migu.cn/v3/api/music/audioPlayer/getLyric"
	GetSongPicAPI      = "http://music.migu.cn/v3/api/music/audioPlayer/getSongPic"
	GetArtistInfoAPI   = "https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?needSimple=01&resourceType=2002"
	GetArtistSongAPI   = "https://app.c.nf.migu.cn/MIGUM3.0/v1.0/template/singerSongs/release?templateVersion=2"
	GetAlbumAPI        = "https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?needSimple=01&resourceType=2003"
	GetPlaylistAPI     = "https://app.c.nf.migu.cn/MIGUM2.0/v1.0/content/resourceinfo.do?needSimple=01&resourceType=2021"

	SongPlayURL = "" /* 141-byte string literal not displayed */

	SongDefaultBR = 128
)

Variables

This section is empty.

Functions

func Client

func Client() provider.API

func GetAlbum

func GetAlbum(albumId string) (*provider.Album, error)

func GetArtist

func GetArtist(singerId string) (*provider.Artist, error)

func GetPlaylist

func GetPlaylist(playlistId string) (*provider.Playlist, error)

func GetSong

func GetSong(copyrightId string) (*provider.Song, error)

func GetSongId

func GetSongId(copyrightId string) (string, error)

func GetSongLyric

func GetSongLyric(copyrightId string) (string, error)

func GetSongPic

func GetSongPic(songId string) (string, error)

func GetSongURL

func GetSongURL(contentId string, br int) string

func Request

func Request(method string, url string, opts ...sreq.RequestOption) *sreq.Response

func SearchSong

func SearchSong(keyword string) (*provider.SearchResult, error)

Types

type API

type API struct {
	Client *sreq.Client
}

func New

func New(client *sreq.Client) *API

func (*API) GetAlbum

func (a *API) GetAlbum(albumId string) (*provider.Album, error)

func (*API) GetAlbumRaw

func (a *API) GetAlbumRaw(albumId string) (*AlbumResponse, error)

获取专辑

func (*API) GetArtist

func (a *API) GetArtist(singerId string) (*provider.Artist, error)

func (*API) GetArtistInfoRaw

func (a *API) GetArtistInfoRaw(singerId string) (*ArtistInfoResponse, error)

获取歌手信息

func (*API) GetArtistSongRaw

func (a *API) GetArtistSongRaw(singerId string, page int, pageSize int) (*ArtistSongResponse, error)

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

func (*API) GetPlaylist

func (a *API) GetPlaylist(playlistId string) (*provider.Playlist, error)

func (*API) GetPlaylistRaw

func (a *API) GetPlaylistRaw(playlistId string) (*PlaylistResponse, error)

获取歌单

func (*API) GetSong

func (a *API) GetSong(copyrightId string) (*provider.Song, error)

func (*API) GetSongId

func (a *API) GetSongId(copyrightId string) (string, error)

func (*API) GetSongIdRaw

func (a *API) GetSongIdRaw(copyrightId string) (*SongIdResponse, error)

根据版权id获取歌曲id

func (*API) GetSongLyric

func (a *API) GetSongLyric(copyrightId string) (string, error)

func (*API) GetSongLyricRaw

func (a *API) GetSongLyricRaw(copyrightId string) (*SongLyricResponse, error)

获取歌词

func (*API) GetSongPic

func (a *API) GetSongPic(songId string) (string, error)

func (*API) GetSongPicRaw

func (a *API) GetSongPicRaw(songId string) (*SongPicResponse, error)

获取歌曲专辑封面

func (*API) GetSongRaw

func (a *API) GetSongRaw(songId string) (*SongResponse, error)

获取歌曲信息

func (*API) GetSongURL

func (a *API) GetSongURL(contentId string, br int) string

func (*API) GetSongURLRaw

func (a *API) GetSongURLRaw(contentId, resourceType string) (*SongURLResponse, error)

获取歌曲播放地址

func (*API) Platform

func (a *API) Platform() int

func (*API) Request

func (a *API) Request(method string, url string, opts ...sreq.RequestOption) *sreq.Response

func (*API) SearchSong

func (a *API) SearchSong(keyword string) (*provider.SearchResult, error)

func (*API) SearchSongRaw

func (a *API) SearchSongRaw(keyword string, page int, pageSize int) (*SongSearchResponse, 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"`
	PicURL       string    `json:"-"`
}

type AlbumResponse

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

func GetAlbumRaw

func GetAlbumRaw(albumId string) (*AlbumResponse, error)

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"`
	PicURL       string    `json:"-"`
}

type ArtistInfoResponse

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

func GetArtistInfoRaw

func GetArtistInfoRaw(singerId string) (*ArtistInfoResponse, error)

func (*ArtistInfoResponse) String

func (a *ArtistInfoResponse) String() string

type ArtistSongResponse

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

func GetArtistSongRaw

func GetArtistSongRaw(singerId string, page int, pageSize int) (*ArtistSongResponse, error)

func (*ArtistSongResponse) String

func (a *ArtistSongResponse) 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 GetPlaylistRaw

func GetPlaylistRaw(playlistId string) (*PlaylistResponse, error)

func (*PlaylistResponse) String

func (p *PlaylistResponse) String() string

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 GetSongIdRaw

func GetSongIdRaw(copyrightId string) (*SongIdResponse, error)

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 GetSongLyricRaw

func GetSongLyricRaw(copyrightId string) (*SongLyricResponse, error)

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 GetSongPicRaw

func GetSongPicRaw(songId string) (*SongPicResponse, error)

func (*SongPicResponse) String

func (s *SongPicResponse) String() string

type SongResponse

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

func GetSongRaw

func GetSongRaw(songId string) (*SongResponse, error)

func (*SongResponse) String

func (s *SongResponse) String() string

type SongSearchResponse

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

func SearchSongRaw

func SearchSongRaw(keyword string, page int, pageSize int) (*SongSearchResponse, error)

func (*SongSearchResponse) String

func (s *SongSearchResponse) String() string

type SongSearchResult

type SongSearchResult 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 SongURLResponse

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

func GetSongURLRaw

func GetSongURLRaw(contentId, resourceType string) (*SongURLResponse, error)

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