xiami

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APPKey = "23649156"
)

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, artistId string, page int, pageSize int) (*api.Collection, error)

func (*API) GetArtistInfoRaw

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

获取歌手信息

func (*API) GetArtistSongsRaw

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

获取歌手歌曲

func (*API) GetPlayLists

func (a *API) GetPlayLists(ctx context.Context, page int, pageSize int) ([]*api.Playlist, error)

func (*API) GetPlaylist

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

func (*API) GetPlaylistDetailRaw

func (a *API) GetPlaylistDetailRaw(ctx context.Context, playlistId string, page int, pageSize int) (*PlaylistDetailResponse, error)

获取歌单详情,包含歌单信息跟歌曲

func (*API) GetPlaylistSongsRaw

func (a *API) GetPlaylistSongsRaw(ctx context.Context, playlistId string, page int, pageSize int) (*PlaylistSongsResponse, error)

获取歌单歌曲,不包含歌单信息

func (*API) GetRank

func (a *API) GetRank(ctx context.Context) ([]*api.Rank, error)

func (*API) GetRankList

func (a *API) GetRankList(ctx context.Context, bangId string, page int, pageSize int) ([]*api.Song, error)

func (*API) GetSong

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

func (*API) GetSongDetailRaw

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

获取歌曲详情

func (*API) GetSongLyric

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

func (*API) GetSongLyricRaw

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

获取歌词

func (*API) GetSongsRaw

func (a *API) GetSongsRaw(ctx context.Context, songIds ...string) (*SongsResponse, error)

批量获取歌曲,上限200首

func (*API) LoginRaw

func (a *API) LoginRaw(ctx context.Context, account string, password string) (*LoginResponse, error)

登录接口,account 可为邮箱/手机号码

func (*API) SearchSongs

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

func (*API) SearchSongsRaw

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

SearchSongsRaw 搜索歌曲

func (*API) SendRequest

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

type Album

type Album struct {
	AlbumId       string `json:"albumId"`
	AlbumStringId string `json:"albumStringId"`
	AlbumName     string `json:"albumName"`
}

type AlbumResponse

type AlbumResponse struct {
	CommonResponse
	Data struct {
		Data struct {
			AlbumDetail struct {
				Album
				Songs []*Song `json:"songs"`
			} `json:"albumDetail"`
		} `json:"data"`
	} `json:"data"`
}

func (*AlbumResponse) String

func (a *AlbumResponse) String() string

type Artist

type Artist struct {
	ArtistId       string `json:"artistId"`
	ArtistStringId string `json:"artistStringId"`
	ArtistName     string `json:"artistName"`
}

type ArtistInfoResponse

type ArtistInfoResponse struct {
	CommonResponse
	Data struct {
		Data struct {
			ArtistDetailVO Artist `json:"artistDetailVO"`
		} `json:"data"`
	} `json:"data"`
}

func (*ArtistInfoResponse) String

func (a *ArtistInfoResponse) String() string

type ArtistSongsResponse

type ArtistSongsResponse struct {
	CommonResponse
	Data struct {
		Data struct {
			PagingVO PagingVO `json:"pagingVO"`
			Songs    []*Song  `json:"songs"`
		} `json:"data"`
	} `json:"data"`
}

func (*ArtistSongsResponse) String

func (a *ArtistSongsResponse) String() string

type CommonResponse

type CommonResponse struct {
	API string   `json:"api"`
	Ret []string `json:"ret"`
}

type ListenFile

type ListenFile struct {
	Expire     string `json:"expire,omitempty"`
	FileSize   string `json:"fileSize"`
	Format     string `json:"format"`
	ListenFile string `json:"listenFile,omitempty"`
	Quality    string `json:"quality"`
	URL        string `json:"url,omitempty"`
}

type LoginResponse

type LoginResponse struct {
	CommonResponse
	Data struct {
		Data struct {
			AccessToken    string `json:"accessToken"`
			Expires        string `json:"expires"`
			NickName       string `json:"nickName"`
			RefreshExpires string `json:"refreshExpires"`
			RefreshToken   string `json:"refreshToken"`
			UserId         string `json:"userId"`
		} `json:"data"`
	} `json:"data"`
}

func (*LoginResponse) String

func (l *LoginResponse) String() string

type PagingVO

type PagingVO struct {
	Count    string `json:"count"`
	Page     string `json:"page"`
	PageSize string `json:"pageSize"`
	Pages    string `json:"pages"`
}

type PlaylistDetailResponse

type PlaylistDetailResponse struct {
	CommonResponse
	Data struct {
		Data struct {
			CollectDetail struct {
				ListId      string   `json:"listId"`
				CollectName string   `json:"collectName"`
				CollectLogo string   `json:"collectLogo"`
				SongCount   string   `json:"songCount"`
				AllSongs    []string `json:"allSongs"`
				Songs       []*Song  `json:"songs"`
				PagingVO    PagingVO `json:"pagingVO"`
			} `json:"collectDetail"`
		} `json:"data"`
	} `json:"data"`
}

func (*PlaylistDetailResponse) String

func (p *PlaylistDetailResponse) String() string

type PlaylistSongsResponse

type PlaylistSongsResponse struct {
	CommonResponse
	Data struct {
		Data struct {
			Songs    []*Song  `json:"songs"`
			PagingVO PagingVO `json:"pagingVO"`
		} `json:"data"`
	} `json:"data"`
}

func (*PlaylistSongsResponse) String

func (p *PlaylistSongsResponse) String() string

type SearchSongsResponse

type SearchSongsResponse struct {
	CommonResponse
	Data struct {
		Data struct {
			PagingVO PagingVO `json:"pagingVO"`
			Songs    []*Song  `json:"songs"`
		} `json:"data"`
	} `json:"data"`
}

func (*SearchSongsResponse) String

func (s *SearchSongsResponse) String() string

type Song

type Song struct {
	Album
	SongId       string       `json:"songId"`
	SongStringId string       `json:"songStringId"`
	SongName     string       `json:"songName"`
	Singers      string       `json:"singers"`
	SingerVOs    []Artist     `json:"singerVOs"`
	ListenFile   string       `json:"listenFile,omitempty"`
	ListenFiles  []ListenFile `json:"listenFiles"`
	Lyric        string       `json:"-"`
}

type SongDetailResponse

type SongDetailResponse struct {
	CommonResponse
	Data struct {
		Data struct {
			SongDetail Song `json:"songDetail"`
		} `json:"data"`
	} `json:"data"`
}

func (*SongDetailResponse) String

func (s *SongDetailResponse) String() string

type SongLyricResponse

type SongLyricResponse struct {
	CommonResponse
	Data struct {
		Data struct {
			Lyrics []struct {
				Content      string `json:"content"`
				FlagOfficial string `json:"flagOfficial"`
				LyricURL     string `json:"lyricUrl"`
				Type         string `json:"type"`
			} `json:"lyrics"`
		} `json:"data"`
	} `json:"data"`
}

type SongsResponse

type SongsResponse struct {
	CommonResponse
	Data struct {
		Data struct {
			Songs []*Song `json:"songs"`
		} `json:"data"`
	} `json:"data"`
}

func (*SongsResponse) String

func (s *SongsResponse) String() string

Jump to

Keyboard shortcuts

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