Documentation ¶
Overview ¶
DO NOT EDIT
Index ¶
Constants ¶
View Source
const ( HTML = "html" JSON = "json" JSONXpath = "json.xpath" XML = "xml" XPATH = "xpath" )
View Source
const ( FieldTypeCommon = "" FieldTypeObject = "object" FieldTypeArray = "array" )
View Source
const ( TaskTypeSource = "source" TaskTypeRequest = "request" TaskTypeQuery = "query" DefaultRequestTimeout = 5 * time.Second DefaultAcceptLanguage = "en-US;q=0.6,en;q=0.4" DefaultEncoding = "utf-8" )
Variables ¶
View Source
var (
ErrDocumentIsNil = errors.New("document is nil")
)
Functions ¶
This section is empty.
Types ¶
type Args ¶
type Args struct { ResultBuilder *ResultBuilder ExecuteTime time.Duration // contains filtered or unexported fields }
Args is a struct for passing arguments to scraper.
type Field ¶
type Field struct { Path string `json:"path,omitempty"` Type string `json:"type,omitempty"` Query string `json:"query,omitempty"` // XPath or JSONPath or CSS selector // Element is used for FieldTypeArray Element *Field `json:"element,omitempty"` // Object is used for FieldTypeObject Object []*Field `json:"object,omitempty"` // Transformers is a list of transformers to apply to the field. Transformers transform.Transformers `json:"transformers,omitempty"` }
Field describes a field in result.
type ResultBuilder ¶
type ResultBuilder struct {
// contains filtered or unexported fields
}
func NewResultBuilder ¶
func NewResultBuilder() *ResultBuilder
func (*ResultBuilder) GetData ¶
func (b *ResultBuilder) GetData() []byte
func (*ResultBuilder) GetString ¶
func (b *ResultBuilder) GetString() string
func (*ResultBuilder) Set ¶
func (b *ResultBuilder) Set(path string, value interface{}, transformers ...transform.Transformer)
Click to show internal directories.
Click to hide internal directories.