crawler

package
v0.19.6 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PowerfulFind

func PowerfulFind(s *goquery.Selection, q string) *goquery.Selection

Types

type Crawler

type Crawler struct {
	Send func(id, name string, out []map[string]string)
	// contains filtered or unexported fields
}

func New

func New() *Crawler

func (*Crawler) Init

func (s *Crawler) Init(rules ...Rule) error

func (*Crawler) Run

func (s *Crawler) Run()

func (*Crawler) Shutdown

func (s *Crawler) Shutdown()

type Fun

type Fun struct {
	Name   string
	Raw    string
	Params []string

	Document  *goquery.Document
	Selection *goquery.Selection
	Result    string

	PrevFun *Fun
	NextFun *Fun
}

func ParseFun

func ParseFun(sel *goquery.Selection, str string) *Fun

func (*Fun) Append

func (f *Fun) Append(s string) (*Fun, *Fun)

func (*Fun) InitSelector

func (f *Fun) InitSelector() error

func (*Fun) Invoke

func (f *Fun) Invoke() (string, error)

type Result

type Result struct {
	Name   string
	ID     string
	Mode   string
	Result []map[string]string
}

type Rule

type Rule struct {
	Name   string
	Enable bool
	Id     string
	When   string
	Mode   string
	Page   *struct {
		URL  string
		List string
		Item map[string]string
	} `json:"page,omitempty"`
	Json *struct {
		URL  string
		List string
		Item map[string]string
	} `json:"json,omitempty"`
	Feed *struct {
		URL  string
		Item map[string]string
	} `json:"feed,omitempty"`
}

func (Rule) Run

func (r Rule) Run() []map[string]string

Jump to

Keyboard shortcuts

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