util

package
v0.0.0-...-92cf2b6 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpAll

func DumpAll(n *query.Node, cs ...ex.Checker)

DumpAll dumps all the nodes in the HTML DOM that satisfy the checkers provided.

func DumpAllText

func DumpAllText(n *query.Node, pat string)

DumpAllText dumps all the text node in the HTML DOM that satisfy the regular expression provided.

func MustLoadHTML

func MustLoadHTML(file string) *query.Node

MustLoadHTML loads and parses an HTML file.

func MustLoadJSON

func MustLoadJSON(file string, v interface{})

MustLoadJSON loads and parses a JSON file.

func Run

func Run(tasks ...interface{})

Run runs tasks and print the data fetched.

Types

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response provides convenient methods to save an HTTP response's body.

func MustGet

func MustGet(url string) Response

MustGet gets the response of a URL or panics if any error occurs.

func (Response) Close

func (r Response) Close()

Close the reponse.

func (Response) Save

func (r Response) Save(file string) error

Save the response body to a file.

func (Response) SavePrettyJSON

func (r Response) SavePrettyJSON(file string) error

SavePrettyJSON prettily formats a JSON response and save it to a file.

Jump to

Keyboard shortcuts

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