raccoon

package module
v0.0.0-...-3eb5722 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2014 License: MIT Imports: 8 Imported by: 0

README

Raccoon

Build Status

Raccoon is a simple web-spider framework driven by Golang and Lua.

Install

Install the package:

$ go get github.com/mikespook/raccoon

Install the CLI command:

$go get github.com/mikespook/raccoon/cmd/raccoon

Usage

Raccoon's parser can be used for parsing html in Golang application directly:

p := raccoon.New("http://www.example.com/")
p.Html(html.SelfClosingTagToken, func(token html.Token) error {
	if token.DataAtom.String() != "meta" {
		return fmt.Errorf("meta is expected, got %s", token.DataAtom.String())
	}
	return nil
})
if err := r.Parse(); err != nil {
	// handling error
}

Or using lua scripts:

p := raccoon.New("http://www.example.com/")
l := raccoon.LuaWrap(p)
if err := l.DoFile("foobar.lua"); err != nil {
	// handling error
}
function SelfClosingTagToken(token)
	if token.DataAtom ~= "meta" then
		error("meta is expected, got " .. token.DataAtom)
	end
end

raccoon.Html(raccoon.Token.SelfClosingTag, SelfClosingTagToken)
raccoon.Parse()

Contributors

(Alphabetic order)

Open Source - MIT Software License

See LICENSE.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LuaWrap

func LuaWrap(p *parser) *luaWrap

func New

func New(url string) (p *parser)

Types

type TokenHandler

type TokenHandler func(html.Token) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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