scraper

package module
v0.0.0-...-12c2aea Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Event_BeforeRequest = string(iota)
	Event_BeforeUnmarshal
)

Variables

This section is empty.

Functions

func CombineURL

func CombineURL(base string, appendQuery map[string]string) url.URL

func Scrape

func Scrape()

Types

type Error

type Error struct {
	ErrCode uint
	ErrMsg  string
	ErrUrl  url.URL
}

func (*Error) Error

func (err *Error) Error() string

func (*Error) String

func (err *Error) String() string

type Method

type Method byte
const (
	GET Method = 1 << iota
	POST
)

func (Method) String

func (m Method) String() string

type Result

type Result struct {
	Resp *http.Response
	Buf  bytes.Buffer
	Json JSlike.Any
}

type Scraper

type Scraper struct {
	Url       url.URL
	Method    string
	Result    Result
	AfterInit func()
	EventBus  event.Bus
}

func (*Scraper) Get

func (scr *Scraper) Get(baseUrl string, query map[string]string) error

func (*Scraper) Post

func (scr *Scraper) Post(baseUrl string, query map[string]string, data io.Reader) error

func (*Scraper) Ready

func (scr *Scraper) Ready(method Method, baseUrl string, query map[string]string)

func (*Scraper) Request

func (scr *Scraper) Request(data io.Reader, header map[string]string) error

Jump to

Keyboard shortcuts

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