vBrowser

package module
v0.0.0-...-7d64ebe Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 5 Imported by: 0

README

go-vBrowser

a handy library for http(s) client to perform like a browser.

Document

GoDoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Browser

type Browser struct {
	UserAgent string
	CookieJar http.CookieJar
}

func NewBrowser

func NewBrowser() (browser *Browser)

func (*Browser) NewTab

func (b *Browser) NewTab() (tab *Tab)

type Error

type Error struct {
	Op  Op
	Err error
}

func (*Error) Error

func (e *Error) Error() string

type Op

type Op string
const (
	ParseURL      Op = "parseURL"
	CreateRequest Op = "createRequest"
	DoRequest     Op = "doRequest"
)

type Tab

type Tab struct {
	Location     *url.URL
	PageResponse *http.Response

	BeforeAjax []func(r *http.Request)
	AfterAjax  []func(r *http.Response)
	// contains filtered or unexported fields
}

func (*Tab) DoAjax

func (t *Tab) DoAjax(req *http.Request) (page *http.Response, err error)

ajax

func (*Tab) GetPageCookie

func (t *Tab) GetPageCookie() []*http.Cookie

func (*Tab) Jump

func (t *Tab) Jump(jumpUrl string) (err error)

jump to a page in the tab (with referer)

func (*Tab) Open

func (t *Tab) Open(url string) (err error)

Load a new page in the tab (without referer)

func (*Tab) Request

func (t *Tab) Request(method, url string, body io.Reader) (page *http.Response, err error)

request a url (ajax)

Jump to

Keyboard shortcuts

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