Documentation
¶
Index ¶
- Constants
- Variables
- func DetectProxy() (result bool)
- func EvaluateEquation(javascript string) (result int, err error)
- func GetClient(r *http.Request) (client *http.Client)
- func IdentifityJSONFragment(jsonString string) (result int, index int)
- func IsolateJSON(jsonString string, jsonTypeIn int) (result string, jsonType int)
- func TidyJSON(jsonString string, jsonType int) (result string)
- func TidyScript(jsonString string) (result string)
- func TidyValues(jsonString string, jsonType int) (result string)
- func ToJSON(jsonMap JSONMapType) (result string, err error)
- type DOM
- func (id *DOM) ChildFind(parent *DOMNode, tag string, attributes DOMNodeAttributes) (result []*DOMNode)
- func (id *DOM) ChildFindJSONForScriptWithKeyDelimiter(parent *DOMNode, substring string, jsonType int) (result JSONMapType, err error)
- func (id *DOM) ChildFindTextForClass(parent *DOMNode, tag string, class string) (result string)
- func (id *DOM) ChildFindWithKey(parent *DOMNode, tag string, substring string) (result []*DOMNode)
- func (id *DOM) ContentLength() int
- func (id *DOM) Contents() string
- func (id *DOM) Dump()
- func (id *DOM) Find(tag string, attributes DOMNodeAttributes) (result []*DOMNode)
- func (id *DOM) FindJSONForScriptWithKey(substring string) (result JSONMapType, err error)
- func (id *DOM) FindJSONForScriptWithKeyDelimiter(substring string, jsonType int) (result JSONMapType, err error)
- func (id *DOM) FindTextForClass(tag string, class string) (result string)
- func (id *DOM) FindWithKey(tag string, substring string) (result []*DOMNode)
- func (id *DOM) IsChildNode(parent *DOMNode, node *DOMNode) (result bool)
- func (id *DOM) IsDescendantNode(parent *DOMNode, node *DOMNode) (result bool)
- func (id *DOM) RootNode() (result *DOMNode)
- func (id *DOM) SetContents(htmlString string)
- func (id *DOM) String() (result string)
- type DOMNode
- type DOMNodeAttributes
- type HTML
- type HTTP
- func (id *HTTP) ContentType() string
- func (id *HTTP) Contents() string
- func (id *HTTP) Get(urlString string) (result string)
- func (id *HTTP) GetQuery(urlString string, args map[string]string) (result string)
- func (id *HTTP) Host() string
- func (id *HTTP) JSON() (result map[string]interface{}, err error)
- func (id *HTTP) Location() string
- func (id *HTTP) Post(urlString string, args map[string]string) (result string)
- func (id *HTTP) PostContent(urlString string, contentType string, content *bytes.Buffer) (result string)
- func (id *HTTP) PostData(urlString string, contentType string, contentBytes []byte) (result string)
- func (id *HTTP) PostString(urlString string, contentType string, contentString string) (result string)
- func (id *HTTP) Referer() string
- func (id *HTTP) SetGAERequest(req *http.Request)
- func (id *HTTP) Status() int
- func (id *HTTP) URLString() (urlString string)
- type JSONMapType
- type JSONSliceType
- type JScript
Constants ¶
const ( HTTP_GET = "GET" HTTP_POST = "POST" )
const ( CONTENT_TYPE_DEFAULT = "" CONTENT_TYPE_FORM = "application/x-www-form-urlencoded" CONTENT_TYPE_JSON = "application/json" CONTENT_TYPE_FORM_MULTI = "multipart/form-data" )
const ( JSONArrayType = iota JSONDictionaryType JSONUnknownType )
Variables ¶
var HTTP_USER_AGENT = []string{
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A",
"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36",
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36",
}
Functions ¶
func DetectProxy ¶
func DetectProxy() (result bool)
Assumes a local HTTP proxy is anything listening locally on port 8080
func EvaluateEquation ¶
func IdentifityJSONFragment ¶
IdentifityJSONFragment
func IsolateJSON ¶
IsolateJSON isolates the JSON parsable text based on array or dictionary delimiters
Types ¶
type DOM ¶
type DOM struct {
// contains filtered or unexported fields
}
DOM Document.
func (*DOM) ChildFind ¶
func (id *DOM) ChildFind(parent *DOMNode, tag string, attributes DOMNodeAttributes) (result []*DOMNode)
ChildFind : Find the child Node of type tag with the specified attributes
func (*DOM) ChildFindJSONForScriptWithKeyDelimiter ¶
func (id *DOM) ChildFindJSONForScriptWithKeyDelimiter(parent *DOMNode, substring string, jsonType int) (result JSONMapType, err error)
ChildFindJSONForScriptWithKey : Find the child JSON key with text containing substring
func (*DOM) ChildFindTextForClass ¶
ChildFindTextForClass : Find the child given tag with the specified attributes
func (*DOM) ChildFindWithKey ¶
ChildFindWithKey : Find the child Node of type tag with text containing key
func (*DOM) ContentLength ¶
ContentLength : The byte count of the raw html contents.
func (*DOM) Find ¶
func (id *DOM) Find(tag string, attributes DOMNodeAttributes) (result []*DOMNode)
Find : Find the Node of type tag with the specified attributes
func (*DOM) FindJSONForScriptWithKey ¶
func (id *DOM) FindJSONForScriptWithKey(substring string) (result JSONMapType, err error)
FindJSONForScriptWithKey : Find the JSON key with text containing substring
func (*DOM) FindJSONForScriptWithKeyDelimiter ¶
func (id *DOM) FindJSONForScriptWithKeyDelimiter(substring string, jsonType int) (result JSONMapType, err error)
func (*DOM) FindTextForClass ¶
FindTextForClass : Find the given tag with the specified attributes
func (*DOM) FindWithKey ¶
FindWithKey : Find the Node of type tag with text containing key
func (*DOM) IsChildNode ¶
IsChildNode : Is node a child of parent? The fastest confirmation is bottom up since the relationships are one to many.
func (*DOM) IsDescendantNode ¶
IsDescendantNode : Is node a descendant of parent? The fastest confirmation is bottom up since the relationships are one to many.
func (*DOM) SetContents ¶
SetContents : parse the raw html contents.
type DOMNode ¶
type DOMNode struct { Index int Tag string Attributes DOMNodeAttributes TextFragments []string Parent *DOMNode Children []*DOMNode }
DOMNode def
func NewDOMNode ¶
func NewDOMNode(index int, parent *DOMNode, tag string, attributes DOMNodeAttributes) *DOMNode
NewDOMNode constructor
func (*DOMNode) ReaderText ¶
ReaderText recombines the node text fragments into the human reader visibile text
type DOMNodeAttributes ¶
DOMNodeAttributes map of strings keyed by strings
type HTTP ¶
type HTTP struct { Method string URL *url.URL ProxyURL *url.URL RawContents []byte // contains filtered or unexported fields }
func (*HTTP) PostContent ¶
func (id *HTTP) PostContent(urlString string, contentType string, content *bytes.Buffer) (result string)
Fetch: POST request
func (*HTTP) PostString ¶
func (*HTTP) SetGAERequest ¶
type JSONMapType ¶
type JSONMapType map[string]interface{}
func ExtractJSON ¶
func ExtractJSON(jsonString string, jsonType int) (result JSONMapType, err error)
ExtractJSON isolates and tidys JSON string while attepting to parse the contents into a JSONMap
type JSONSliceType ¶
type JSONSliceType []interface{}