pick

package module
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2017 License: MIT Imports: 3 Imported by: 7

README

pick Build Status

pick stuff from html

installation

go get -u gopkg.in/ddo/pick.v1

TODO:

  • #GetForm
  • NewTokenizerFragment
  • NextIsNotRawText
  • 1 testing html but cover all cases
  • script
  • AllowCDATA
  • benchmark

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PickAttr

func PickAttr(option *Option, AttrLabel string, limit int) (res []string)

PickAttr gets attribute Option.Attr of elements that matches the Option.TagName

func PickForm added in v1.2.0

func PickForm(reader io.Reader, attr *Attr) (input map[string][]string)

input can be input/select/textarea TODO: now only get 1st value, need []string as result TODO: pick select option that has no value attr TODO: radio

func PickHtml added in v1.1.0

func PickHtml(option *Option, limit int) (res []string)

PickHtml gets html of elements that matches the Option.TagName (including it's child elements)

func PickText

func PickText(option *Option, limit int) (res []string)

PickText gets text of elements that matches the Option.TagName (including it's child elements)

Types

type Attr

type Attr struct {
	Label string
	Value string
}

Attr to define an element's attribute <input type="hidden" /> -> Attr{Label: "type", Value: "hidden"}

type Option

type Option struct {
	PageSource io.Reader
	TagName    string
	Attr       *Attr // optional
}

Option PageSource: html reader TagName: element's tag. ex: div, p, form, input...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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