Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) Cookie(url, name string) (http.Cookie, bool)
- func (c *Client) Download(ctx context.Context, url string, headers map[string]string, reqBody io.Reader, ...) (*http.Response, error)
- func (c *Client) GetCSRF(url string) (string, bool)
- func (c *Client) GetClient() *http.Client
- func (c *Client) GetCookies(url *neturl.URL) []*http.Cookie
- func (c *Client) GetDeviceId() string
- func (c *Client) MusicU() string
- func (c *Client) NewRequest(mode ...CryptoMode) *resty.Request
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Request(ctx context.Context, url string, req, resp interface{}, opts *Options) (*resty.Response, error)
- func (c *Client) SetCookies(url *neturl.URL, cookies []*http.Cookie)
- func (c *Client) Upload(ctx context.Context, url string, headers map[string]string, data io.Reader, ...) (*resty.Response, error)
- func (c *Client) UserAgent(mode CryptoMode) string
- type Config
- type CryptoMode
- type Options
- type UserAgentConfig
Constants ¶
View Source
const ( DefaultWEAPIUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) NeteaseMusicDesktop/2.3.17.1034" DefaultEAPIUserAgent = "NeteaseMusic 9.4.95/6806 (iPhone; iOS 16.6.1; zh_CN)" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetDeviceId ¶ added in v1.1.4
GetDeviceId 从当前客户端的 Cookie 中获取设备 ID
func (*Client) NewRequest ¶
func (c *Client) NewRequest(mode ...CryptoMode) *resty.Request
func (*Client) Request ¶
func (c *Client) Request(ctx context.Context, url string, req, resp interface{}, opts *Options) (*resty.Response, error)
Request 接口请求.
func (*Client) SetCookies ¶
SetCookies 设置cookies.
func (*Client) UserAgent ¶
func (c *Client) UserAgent(mode CryptoMode) string
type Config ¶
type CryptoMode ¶
type CryptoMode string
const ( CryptoModeAPI CryptoMode = "api" CryptoModeEAPI CryptoMode = "eapi" CryptoModeXEAPI CryptoMode = "xeapi" CryptoModeWEAPI CryptoMode = "weapi" CryptoModeLinux CryptoMode = "linux" )
type Options ¶
type Options struct {
Method string
CryptoMode CryptoMode
Headers map[string]string
Cookies []*http.Cookie
}
func NewOptions ¶
func NewOptions() *Options
func (*Options) SetCookies ¶
Click to show internal directories.
Click to hide internal directories.