request

package
v0.0.0-...-0c245d3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent string = "" /* 129-byte string literal not displayed */
	Referer   string = "https://www.bilibili.com"
)

Variables

View Source
var (
	ErrNoSESSDATA = errors.New("request: no SESSDATA")
	ErrNoBiliJct  = errors.New("request: no bili_jct")
)

Functions

func AddData

func AddData(v interface{ Add(string, string) }, s []Data, api reflect.Value)

func Debug

func Debug(api Api, jar CookieJar) (map[string]any, error)

func Do

func Do[T any](api Api) (zero T, err error)

func DoWithMap

func DoWithMap(api Api) (map[string]any, error)

func EncWbi

func EncWbi(query url.Values, mixinKey string)

更新请求参数

func GetWbiMixinKey

func GetWbiMixinKey() (string, error)

func NewRequest

func NewRequest(api Api, jar CookieJar) (req *http.Request, err error)

func TypePtr

func TypePtr(in any) uintptr

func UpdateWbiMixinKey

func UpdateWbiMixinKey() error

func ValuePtr

func ValuePtr(in any) uintptr

Types

type Any

type Any struct {
	Type  unsafe.Pointer
	Value unsafe.Pointer
}

type Api

type Api interface {
	URL() string
	Method() string
}

type ApiError

type ApiError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (ApiError) Error

func (err ApiError) Error() string

type CookieJar

type CookieJar interface {
	http.CookieJar
	IsValid() bool
	GetSESSDATA() string
	GetBiliJct() string
	GetBuvid3() string
}

type Data

type Data struct {
	Index int
	Name  string
	Value string
	Omit  bool
}

type JsonBody

type JsonBody interface{ MethodJsonBody() }

type Marshaler

type Marshaler interface {
	MarshalString() (string, error)
}

type NoCSRF

type NoCSRF interface{ MethodNoCSRF() }

type NoWrapper

type NoWrapper interface{ MethodNoWrapper() }

type Request

type Request struct {
	Body   []Data
	Query  []Data
	Header []Data
}

type RequestMap

type RequestMap struct {
	// contains filtered or unexported fields
}

func NewRequestMap

func NewRequestMap() *RequestMap

func (*RequestMap) Find

func (r *RequestMap) Find(ptr uintptr) (req Request, exists bool)

func (*RequestMap) Get

func (r *RequestMap) Get(typ reflect.Type) Request

type Result

type Result[Data any] struct {
	ApiError
	TTL  int  `json:"ttl"`
	Data Data `json:"data"`
}

type Verify

type Verify interface{ MethodVerify() }

type Wbi

type Wbi interface{ MethodWbi() }

Jump to

Keyboard shortcuts

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