Documentation ¶
Index ¶
- Constants
- func GetHTML(URL string) (string, error)
- func GetHTMLNode(data string) (*html.Node, error)
- func GetTextOfNode(node *html.Node, notRecursive bool) (text string)
- func RenderNode(node *html.Node) string
- type Element
- type ErrType
- type Error
- type FormatSettings
- type HtmlElement
- type ReplaceObj
- type Settings
- type Tag
- type Website
Constants ¶
const ( // ErrMissingElement will be returned if the element is issing ErrMissingElement = iota // ErrNoNodeFound will be returned if no element was found ErrNoNodeFound // ErrIdxOutOfRange will be returned if the index of an array is out of range ErrIdxOutOfRange )
Variables ¶
This section is empty.
Functions ¶
func GetHTMLNode ¶
GetHTMLNode returns the node tree of the html string data
func GetTextOfNode ¶
GetTextOfNode returns the content of an html element
func RenderNode ¶
RenderNode returns the string representation of an html.Node
Types ¶
type Element ¶
type Element struct { HtmlElement `json:"htmlElement"` Settings `json:"settings"` ContentIsFollowURL *Website `json:"followURL"` Index int `json:"index"` }
Element defines the data structure for an element to be looked up by the scraper
type Error ¶
type Error struct { ErrType // contains filtered or unexported fields }
Error defines the data structure for a custom error
type FormatSettings ¶
type FormatSettings struct { Replacements []ReplaceObj `json:"replacements"` Trim []string `json:"trim"` AddBefore string `json:"addBefore"` AddAfter string `json:"addAfter"` }
FormatSettings defines the data structure for optional formatting settings of a LookUpElement
type HtmlElement ¶
HtmlElement defines the data structure for an HTML element
func (*HtmlElement) GetElementNodes ¶
GetElementNodes returns an array of html.Node iniside of htmlNode having the same properties as element e
type ReplaceObj ¶
type ReplaceObj struct { ToBeReplaced string `json:"toBeReplaced"` Replacement string `json:"replacement"` }
ReplaceObj defines the data structure for an object, that has to be replaced
type Settings ¶
type Settings struct { FormatSettings FormatSettings `json:"formatting"` DisallowRecursiveContent bool `json:"disallowRecursiveContent"` }
Settings defines the data structure for optional settings of a LookUpElement