Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikespook/raccoon
A simple web-spider framework driven by Golang and Lua.
https://github.com/mikespook/raccoon
Last synced: 14 days ago
JSON representation
A simple web-spider framework driven by Golang and Lua.
- Host: GitHub
- URL: https://github.com/mikespook/raccoon
- Owner: mikespook
- License: mit
- Created: 2014-02-17T09:52:02.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-02-20T07:46:29.000Z (over 10 years ago)
- Last Synced: 2024-06-19T16:46:14.783Z (5 months ago)
- Language: Go
- Size: 160 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Raccoon
=======[![Build Status][travis-img]][travis]
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:
```go
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:
```go
p := raccoon.New("http://www.example.com/")
l := raccoon.LuaWrap(p)
if err := l.DoFile("foobar.lua"); err != nil {
// handling error
}
``````lua
function SelfClosingTagToken(token)
if token.DataAtom ~= "meta" then
error("meta is expected, got " .. token.DataAtom)
end
endraccoon.Html(raccoon.Token.SelfClosingTag, SelfClosingTagToken)
raccoon.Parse()
```Contributors
============(_Alphabetic order_)
* [Xing Xing][blog] [@Twitter][twitter]Open Source - MIT Software License
==================================See LICENSE.
[travis-img]: https://travis-ci.org/mikespook/raccoon.png?branch=master
[travis]: https://travis-ci.org/mikespook/raccoon
[blog]: http://mikespook.com
[twitter]: http://twitter.com/mikespook