Documentation ¶
Index ¶
- Variables
- func ParseAPIResult(r io.Reader) (ret gjson.Result, err error)
- func With(ctx context.Context, v *Client) context.Context
- type BypassSNIBlockingTransport
- type Client
- func (c *Client) ApplyDefault()
- func (c *Client) BypassSNIBlocking()
- func (c Client) EndpointURL(path string, values *url.Values) *url.URL
- func (c *Client) GetWithContext(ctx context.Context, url string) (resp *http.Response, err error)
- func (c Client) IsLoggedIn() (ret bool, err error)
- func (c *Client) Login(username string, password string) (err error)
- func (c *Client) SetDefaultHeader(key, value string)
- func (c *Client) SetPHPSESSID(v string)
- func (c *Client) SetRequestOptions(options ...RequestOption)
- type RequestOption
- type RequestOptionsTransport
Constants ¶
This section is empty.
Variables ¶
var BlockedHostnames = map[string]struct{}{
"www.pixiv.net": {},
"i.pximg.net": {},
}
BlockedHostnames constains hosts that blocked by sni detect.
var DefaultBypassSNIBlocking = os.Getenv("PIXIV_BYPASS_SNI_BLOCKING") != ""
var DefaultDNSQueryURL = os.Getenv("PIXIV_DNS_QUERY_URL")
DNSQueryURL is DNS over HTTPS service url that act like google public dns json api https://developers.google.com/speed/public-dns/docs/doh/json
var DefaultPHPSESSID = os.Getenv("PIXIV_PHPSESSID")
var DefaultUserAgent = os.Getenv("PIXIV_USER_AGENT")
DefaultUserAgent for new clients
Functions ¶
func ParseAPIResult ¶ added in v0.2.0
ParseAPIResult parses error from json api response, and returns body part.
Types ¶
type BypassSNIBlockingTransport ¶ added in v0.3.2
type BypassSNIBlockingTransport struct {
// contains filtered or unexported fields
}
BypassSNIBlockingTransport bypass sni bloking when host in BlockedHostnames
type Client ¶ added in v0.2.0
Client to send request to pixiv server.
var Default *Client
Default client auto login with PIXIV_PHPSESSID env var.
func NewDefaultClient ¶ added in v0.7.0
func NewDefaultClient() *Client
func (*Client) ApplyDefault ¶ added in v0.7.0
func (c *Client) ApplyDefault()
func (*Client) BypassSNIBlocking ¶ added in v0.3.2
func (c *Client) BypassSNIBlocking()
BypassSNIBlocking wrap current transport with bypass sni blocking support. must set before other settings, because it use a new http.Transport for blocked host
func (Client) EndpointURL ¶ added in v0.2.0
EndpointURL returns url for server endpint.
func (*Client) GetWithContext ¶ added in v0.4.0
GetWithContext create get request with context and do it.
func (Client) IsLoggedIn ¶ added in v0.2.0
IsLoggedIn checks login status base on `HEAD https://www.pixiv.net/setting_user.php` response status.
func (*Client) SetDefaultHeader ¶ added in v0.4.1
SetDefaultHeader for all requests
func (*Client) SetPHPSESSID ¶ added in v0.2.0
SetPHPSESSID set client cookie to skip login.
func (*Client) SetRequestOptions ¶ added in v0.4.1
func (c *Client) SetRequestOptions(options ...RequestOption)
SetRequestOptions for all requests
type RequestOption ¶ added in v0.4.1
RequestOption can mutate request before actual send it.
type RequestOptionsTransport ¶ added in v0.4.1
type RequestOptionsTransport struct {
// contains filtered or unexported fields
}
RequestOptionsTransport allow change request before do it.