crawler

package
v0.0.0-...-c4765d5 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonFileByHostname

func JsonFileByHostname(host string) string

func LoadString

func LoadString(file string) (string, error)

LoadString loads string from file

func Marshal

func Marshal(data []Data) string

Marshal []Data to json string

func ParseTexts

func ParseTexts(dom *goquery.Selection) []string

func Unmarshal

func Unmarshal(s string, datas *[]Data) error

Unmarshal json string to *Data[]

func WriteString

func WriteString(file string, content string) error

WriteString writes string to file

Types

type Crawler

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

Crawler

func New

func New() *Crawler

func (*Crawler) Start

func (c *Crawler) Start()

Start scraping

type Data

type Data struct {
	Title string   `json:"title"`
	URL   string   `json:"url"`
	Texts []string `json:"texts"`
}

Jump to

Keyboard shortcuts

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