netease

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: Apache-2.0, GPL-3.0 Imports: 18 Imported by: 0

README

copy from winterssy/music-get, in order to be used as a package

Documentation

Index

Constants

View Source
const (
	WeAPI       = "https://music.163.com/weapi"
	SongUrlAPI  = "https://music.163.com/weapi/song/enhance/player/url"
	SongAPI     = "https://music.163.com/weapi/v3/song/detail"
	ArtistAPI   = "https://music.163.com/weapi/v1/artist"
	AlbumAPI    = "https://music.163.com/weapi/v1/album"
	PlaylistAPI = "https://music.163.com/weapi/v3/playlist/detail"
	DjradioAPI  = "https://music.163.com/weapi/dj/program/byradio"
	DJAPI       = "https://music.163.com/weapi/dj/program/detail"
)
View Source
const (
	Base62                      = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
	PresetKey                   = "0CoJUm6Qyw8W8jud"
	IV                          = "0102030405060708"
	DefaultRSAPublicKeyModulus  = "" /* 256-byte string literal not displayed */
	DefaultRSAPublicKeyExponent = 0x10001
)

Variables

This section is empty.

Functions

func Encrypt

func Encrypt(origData []byte) (params, encSecKey string, err error)

func ExtractMP3List

func ExtractMP3List(songs []Song, savePath string) ([]*resource.MP3, error)

func Parse

func Parse(url string) (req common.MusicRequest, err error)

Types

type Album

type Album struct {
	Id          int    `json:"id"`
	Name        string `json:"name"`
	PicUrl      string `json:"picUrl"`
	PublishTime int64  `json:"publishTime"`
}

type AlbumParams

type AlbumParams struct{}

type AlbumRequest

type AlbumRequest struct {
	Id       int
	Params   AlbumParams
	Response AlbumResponse
}

func NewAlbumRequest

func NewAlbumRequest(id int) *AlbumRequest

func (*AlbumRequest) Do

func (s *AlbumRequest) Do() error

func (*AlbumRequest) Extract

func (a *AlbumRequest) Extract() ([]*resource.MP3, error)

type AlbumResponse

type AlbumResponse struct {
	SongResponse
	Album Album `json:"album"`
}

type Artist

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

type ArtistParams

type ArtistParams struct{}

type ArtistRequest

type ArtistRequest struct {
	Id       int
	Params   ArtistParams
	Response ArtistResponse
}

func NewArtistRequest

func NewArtistRequest(id int) *ArtistRequest

func (*ArtistRequest) Do

func (r *ArtistRequest) Do() error

func (*ArtistRequest) Extract

func (r *ArtistRequest) Extract() ([]*resource.MP3, error)

type ArtistResponse

type ArtistResponse struct {
	Code     int    `json:"code"`
	Msg      string `json:"msg"`
	Artist   Artist `json:"artist"`
	HotSongs []Song `json:"hotSongs"`
}

type DJParams

type DJParams struct {
	ID int `json:"id"`
}

type DJRequest

type DJRequest struct {
	Params   DJParams
	Response DJResponse
}

func NewDJRequest

func NewDJRequest(id int) *DJRequest

func (*DJRequest) Do

func (s *DJRequest) Do() error

result['program']['mainDJ']['id'],result['program']['mainDJ']['name']

func (*DJRequest) Extract

func (r *DJRequest) Extract() ([]*resource.MP3, error)

type DJResponse

type DJResponse struct {
	Code    int             `json:"code"`
	Msg     string          `json:"msg"`
	Program *DjradioProgram `json:"program"`
}

type DjradioParams

type DjradioParams struct {
	RadioId int `json:"radioId"`
	Limit   int `json:"limit"`
	Offset  int `json:"offset"`
}

type DjradioProgram

type DjradioProgram struct {
	MainSong struct {
		Name string `json:"name"`
		ID   int    `json:"id"`
	} `json:"mainSong"`
	Dj struct {
		Nickname  string `json:"nickname"`
		Signature string `json:"signature"`
		Brand     string `json:"brand"`
	} `json:"dj"`
	BlurCoverURL string `json:"blurCoverUrl"`
	Name         string `json:"name"`
	ID           int64  `json:"id"`
}

type DjradioRequest

type DjradioRequest struct {
	Id       int
	Params   DjradioParams
	Response DjradioResponse
}

func NewDjradioRequest

func NewDjradioRequest(id int) *DjradioRequest

func (*DjradioRequest) Do

func (s *DjradioRequest) Do() error

func (*DjradioRequest) Extract

func (r *DjradioRequest) Extract() ([]*resource.MP3, error)

type DjradioResponse

type DjradioResponse struct {
	Code     int               `json:"code"`
	Msg      string            `json:"msg"`
	Programs []*DjradioProgram `json:"programs"`
}

type Playlist

type Playlist struct {
	Id       int       `json:"id"`
	Name     string    `json:"name"`
	TrackIds []TrackId `json:"trackIds"`
}

type PlaylistParams

type PlaylistParams struct {
	Id int `json:"id"`
}

type PlaylistRequest

type PlaylistRequest struct {
	Params   PlaylistParams
	Response PlaylistResponse
}

func NewPlaylistRequest

func NewPlaylistRequest(id int) *PlaylistRequest

func (*PlaylistRequest) Do

func (s *PlaylistRequest) Do() error

func (*PlaylistRequest) Extract

func (p *PlaylistRequest) Extract() ([]*resource.MP3, error)

type PlaylistResponse

type PlaylistResponse struct {
	Code     int      `json:"code"`
	Msg      string   `json:"msg"`
	Playlist Playlist `json:"playlist"`
}

type Song

type Song struct {
	Id          int      `json:"id"`
	Name        string   `json:"name"`
	Artist      []Artist `json:"ar"`
	Album       Album    `json:"al"`
	Position    int      `json:"no"`
	PublishTime int64    `json:"publishTime"`
}

func (*Song) Extract

func (s *Song) Extract() *resource.MP3

type SongParams

type SongParams struct {
	C string `json:"c"`
}

type SongRequest

type SongRequest struct {
	Params   SongParams
	Response SongResponse
}

func NewSongRequest

func NewSongRequest(ids ...int) *SongRequest

func (*SongRequest) Do

func (s *SongRequest) Do() error

func (*SongRequest) Extract

func (s *SongRequest) Extract() ([]*resource.MP3, error)

type SongResponse

type SongResponse struct {
	Code  int    `json:"code"`
	Msg   string `json:"msg"`
	Songs []Song `json:"songs"`
}

type SongUrl

type SongUrl struct {
	Id   int    `json:"id"`
	Code int    `json:"code"`
	Url  string `json:"url"`
}

type SongUrlParams

type SongUrlParams struct {
	Ids string `json:"ids"`
	Br  int    `json:"br"`
}

type SongUrlRequest

type SongUrlRequest struct {
	Params   SongUrlParams
	Response SongUrlResponse
}

func NewSongUrlRequest

func NewSongUrlRequest(ids ...int) *SongUrlRequest

func (*SongUrlRequest) Do

func (s *SongUrlRequest) Do() error

type SongUrlResponse

type SongUrlResponse struct {
	Code int       `json:"code"`
	Msg  string    `json:"msg"`
	Data []SongUrl `json:"data"`
}

type TrackId

type TrackId struct {
	Id int `json:"id"`
}

Jump to

Keyboard shortcuts

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