netease

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

Documentation

Index

Constants

View Source
const (
	Base62                      = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
	PresetKey                   = "0CoJUm6Qyw8W8jud"
	IV                          = "0102030405060708"
	LinuxAPIKey                 = "rFgB&h#%2?^eDg:Q"
	EAPIKey                     = "e82ckenh8dichen8"
	DefaultRSAPublicKeyModulus  = "" /* 256-byte string literal not displayed */
	DefaultRSAPublicKeyExponent = 0x10001
)

Variables

This section is empty.

Functions

func BytesReverse

func BytesReverse(b []byte) []byte

func CreateSecretKey

func CreateSecretKey(size int, charset string) []byte

Types

type API

type API struct {
	Client *ghttp.Client
}

func Client

func Client() *API

func New

func New(client *ghttp.Client) *API

func (*API) CellphoneLoginRaw

func (a *API) CellphoneLoginRaw(ctx context.Context, countryCode int, phone int, password string) (*LoginResponse, error)

手机登录

func (*API) EmailLoginRaw

func (a *API) EmailLoginRaw(ctx context.Context, email string, password string) (*LoginResponse, error)

邮箱登录

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

获取专辑

func (*API) GetArtist

func (a *API) GetArtist(ctx context.Context, artistId string, page int, pageSize int) (*api.Collection, error)

func (*API) GetArtistRaw

func (a *API) GetArtistRaw(ctx context.Context, artistId int) (*ArtistResponse, 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) GetPlaylistRaw

func (a *API) GetPlaylistRaw(ctx context.Context, playlistId int) (*PlaylistResponse, 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) GetSongLyric

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

func (*API) GetSongLyricRaw

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

获取歌词

func (*API) GetSongURL

func (a *API) GetSongURL(ctx context.Context, id int, br int) (string, error)

func (*API) GetSongsRaw

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

批量获取歌曲详情,上限1000首

func (*API) GetSongsURLRaw

func (a *API) GetSongsURLRaw(ctx context.Context, br int, songIds ...int) (*SongURLResponse, error)

批量获取歌曲播放地址,br: 比特率,128/192/320/999

func (*API) LogoutRaw

func (a *API) LogoutRaw(ctx context.Context) (*CommonResponse, error)

退出登录

func (*API) RefreshLoginRaw

func (a *API) RefreshLoginRaw(ctx context.Context) (*CommonResponse, error)

刷新登录状态

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, offset int, limit int) (*SearchSongsResponse, error)

搜索歌曲

func (*API) SendRequest

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

type Album

type Album struct {
	Id     int    `json:"id"`
	Name   string `json:"name"`
	PicURL string `json:"picUrl"`
}

type AlbumResponse

type AlbumResponse struct {
	CommonResponse
	Album Album   `json:"album"`
	Songs []*Song `json:"songs"`
}

func (*AlbumResponse) String

func (a *AlbumResponse) String() string

type Artist

type Artist struct {
	Id     int    `json:"id"`
	Name   string `json:"name"`
	PicURL string `json:"picUrl"`
}

type ArtistResponse

type ArtistResponse struct {
	CommonResponse
	Artist struct {
		Artist
	} `json:"artist"`
	HotSongs []*Song `json:"hotSongs"`
}

func (*ArtistResponse) String

func (a *ArtistResponse) String() string

type CommonResponse

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

type LoginResponse

type LoginResponse struct {
	CommonResponse
	LoginType int `json:"loginType"`
	Account   struct {
		Id       int    `json:"id"`
		UserName string `json:"userName"`
	} `json:"account"`
}

func (*LoginResponse) String

func (e *LoginResponse) String() string

type PlaylistResponse

type PlaylistResponse struct {
	CommonResponse
	Playlist struct {
		Id       int     `json:"id"`
		Name     string  `json:"name"`
		PicURL   string  `json:"coverImgUrl"`
		Tracks   []*Song `json:"tracks"`
		TrackIds []struct {
			Id int `json:"id"`
		} `json:"trackIds"`
		Total int `json:"trackCount"`
	} `json:"playlist"`
}

func (*PlaylistResponse) String

func (p *PlaylistResponse) String() string

type SearchSongsResponse

type SearchSongsResponse struct {
	CommonResponse
	Result struct {
		Songs []*struct {
			Id      int    `json:"id"`
			Name    string `json:"name"`
			Artists []struct {
				Id   int    `json:"id"`
				Name string `json:"name"`
			} `json:"artists"`
			Album struct {
				Id   int    `json:"id"`
				Name string `json:"name"`
			} `json:"album"`
		} `json:"songs"`
		SongCount int `json:"songCount"`
	} `json:"result"`
}

func (*SearchSongsResponse) String

func (s *SearchSongsResponse) String() string

type Song

type Song struct {
	Id      int      `json:"id"`
	Name    string   `json:"name"`
	Artists []Artist `json:"ar"`
	Album   Album    `json:"al"`
	Track   int      `json:"no"`
	Lyric   string   `json:"-"`
	URL     string   `json:"-"`
}

type SongLyricResponse

type SongLyricResponse struct {
	CommonResponse
	Lrc struct {
		Lyric string `json:"lyric"`
	} `json:"lrc"`
	TLyric struct {
		Lyric string `json:"lyric"`
	} `json:"tlyric"`
}

func (*SongLyricResponse) String

func (s *SongLyricResponse) String() string

type SongURL

type SongURL struct {
	Id   int    `json:"id"`
	URL  string `json:"url"`
	BR   int    `json:"br"`
	Code int    `json:"code"`
}

type SongURLResponse

type SongURLResponse struct {
	CommonResponse
	Data []struct {
		Code int    `json:"code"`
		Id   int    `json:"id"`
		BR   int    `json:"br"`
		URL  string `json:"url"`
	} `json:"data"`
}

func (*SongURLResponse) String

func (s *SongURLResponse) String() string

type SongsResponse

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

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