kuwo

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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SearchAPI        = "http://www.kuwo.cn/api/www/search/searchMusicBykeyWord"
	GetSongAPI       = "http://www.kuwo.cn/api/www/music/musicInfo"
	GetSongPlayAPI   = "http://www.kuwo.cn/url?format=mp3&response=url&type=convert_url3"
	GetSongLyricAPI  = "http://www.kuwo.cn/newh5/singles/songinfoandlrc"
	GetArtistInfoAPI = "http://www.kuwo.cn/api/www/artist/artist"
	GetArtistSongAPI = "http://www.kuwo.cn/api/www/artist/artistMusic"
	GetAlbumAPI      = "http://www.kuwo.cn/api/www/album/albumInfo"
	GetPlaylistAPI   = "http://www.kuwo.cn/api/www/playlist/playListInfo"

	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(artistId string) (*provider.Artist, error)

func GetPlaylist

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

func GetSong

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

func GetSongLyric

func GetSongLyric(mid int) (string, error)

func GetSongURL

func GetSongURL(mid int, br int) (string, error)

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, page int, pageSize int) (*AlbumResponse, error)

获取专辑,page: 页码; pageSize: 每页数量,如果要获取全部请设置为较大的值

func (*API) GetArtist

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

func (*API) GetArtistInfoRaw

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

获取歌手信息

func (*API) GetArtistSongRaw

func (a *API) GetArtistSongRaw(artistId 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, page int, pageSize int) (*PlaylistResponse, error)

获取歌单,page: 页码; pageSize: 每页数量,如果要获取全部请设置为较大的值

func (*API) GetSong

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

func (*API) GetSongLyric

func (a *API) GetSongLyric(mid int) (string, error)

func (*API) GetSongLyricRaw

func (a *API) GetSongLyricRaw(mid int) (*SongLyricResponse, error)

获取歌词

func (*API) GetSongRaw

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

获取歌曲信息

func (*API) GetSongURL

func (a *API) GetSongURL(mid int, br int) (string, error)

func (*API) GetSongURLRaw

func (a *API) GetSongURLRaw(mid int, br int) (*SongURLResponse, error)

获取歌曲播放地址,br: 比特率,128/192/320 可选

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 AlbumResponse

type AlbumResponse struct {
	CommonResponse
	Data struct {
		AlbumId   int     `json:"albumId"`
		Album     string  `json:"album"`
		Pic       string  `json:"pic"`
		MusicList []*Song `json:"musicList"`
	} `json:"data"`
}

func GetAlbumRaw

func GetAlbumRaw(albumId string, page int, pageSize int) (*AlbumResponse, error)

func (*AlbumResponse) String

func (a *AlbumResponse) String() string

type ArtistInfo

type ArtistInfo struct {
	Id     int    `json:"id"`
	Name   string `json:"name"`
	Pic300 string `json:"pic300"`
}

type ArtistInfoResponse

type ArtistInfoResponse struct {
	CommonResponse
	Data ArtistInfo `json:"data"`
}

func GetArtistInfoRaw

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

func (*ArtistInfoResponse) String

func (a *ArtistInfoResponse) String() string

type ArtistSongResponse

type ArtistSongResponse struct {
	CommonResponse
	Data struct {
		List []*Song `json:"list"`
	} `json:"data"`
}

func GetArtistSongRaw

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

func (*ArtistSongResponse) String

func (a *ArtistSongResponse) String() string

type CommonResponse

type CommonResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"msg,omitempty"`
}

type PlaylistResponse

type PlaylistResponse struct {
	CommonResponse
	Data struct {
		Id        int     `json:"id"`
		Name      string  `json:"name"`
		Img700    string  `json:"img700"`
		MusicList []*Song `json:"musicList"`
	} `json:"data"`
}

func GetPlaylistRaw

func GetPlaylistRaw(playlistId string, page int, pageSize int) (*PlaylistResponse, error)

func (*PlaylistResponse) String

func (p *PlaylistResponse) String() string

type Song

type Song struct {
	RId             int    `json:"rid"`
	Name            string `json:"name"`
	ArtistId        int    `json:"artistid"`
	Artist          string `json:"artist"`
	AlbumId         int    `json:"albumid"`
	Album           string `json:"album"`
	AlbumPic        string `json:"albumpic"`
	Track           int    `json:"track"`
	IsListenFee     bool   `json:"isListenFee"`
	SongTimeMinutes string `json:"songTimeMinutes"`
	Lyric           string `json:"-"`
	URL             string `json:"-"`
}

type SongLyricResponse

type SongLyricResponse struct {
	Status int    `json:"status"`
	Msg    string `json:"msg,omitempty"`
	Data   struct {
		LrcList []struct {
			Time      string `json:"time"`
			LineLyric string `json:"lineLyric"`
		} `json:"lrclist"`
	} `json:"data"`
}

func GetSongLyricRaw

func GetSongLyricRaw(mid int) (*SongLyricResponse, error)

func (*SongLyricResponse) String

func (s *SongLyricResponse) String() string

type SongResponse

type SongResponse struct {
	CommonResponse
	Data Song `json:"data"`
}

func GetSongRaw

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

func (*SongResponse) String

func (s *SongResponse) String() string

type SongSearchResponse

type SongSearchResponse struct {
	CommonResponse
	Data struct {
		Total string  `json:"total"`
		List  []*Song `json:"list"`
	} `json:"data"`
}

func SearchSongRaw

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

func (*SongSearchResponse) String

func (s *SongSearchResponse) String() string

type SongURLResponse

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

func GetSongURLRaw

func GetSongURLRaw(mid int, br int) (*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