moneinstant

package module
v0.0.0-...-a16730a Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2015 License: ISC Imports: 4 Imported by: 0

README

MoneBot

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoInstant = errors.New("no instant found on page")
	ErrNilPage   = errors.New("page is nil")
)

Errors getting instants

Functions

This section is empty.

Types

type Instant

type Instant interface {
	Name() string
	AudioURL() string
}

Instant contain url and name of instant

type InstantsPage

type InstantsPage struct {
	Source    Source
	Selection *goquery.Selection
	Error     error
}

InstantsPage is a where we look for Instants

func NewInstantsPage

func NewInstantsPage(source Source, relativeURL string) *InstantsPage

NewInstantsPage return an instants page

func (*InstantsPage) All

func (p *InstantsPage) All() ([]Instant, error)

All returns a slice with all instants from page

func (*InstantsPage) At

func (p *InstantsPage) At(index int) (Instant, error)

At returns the instant at an specific index

func (*InstantsPage) First

func (p *InstantsPage) First() (Instant, error)

First returns the first instant from page

func (*InstantsPage) NumSelected

func (p *InstantsPage) NumSelected() int

NumSelected returns the number of nodes that were selected as instants by SelectInstants

type MyInstant

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

MyInstant a MyInstants instant

func (MyInstant) AudioURL

func (instant MyInstant) AudioURL() string

AudioURL returns the instant audio url

func (MyInstant) Name

func (instant MyInstant) Name() string

Name returns the name of instant

type MyInstants

type MyInstants struct{}

MyInstants Source of instants

func (*MyInstants) Home

func (source *MyInstants) Home() *InstantsPage

Home return the MyInstants homepage

func (*MyInstants) MakeInstants

func (source *MyInstants) MakeInstants(sel *goquery.Selection) []Instant

MakeInstants gets all instants inside collection

func (*MyInstants) Query

func (source *MyInstants) Query(name string) *InstantsPage

Query returns an MyInstants query page

func (*MyInstants) Recent

func (source *MyInstants) Recent() *InstantsPage

Recent returns the MyInstants recent page

func (*MyInstants) SelectInstants

func (source *MyInstants) SelectInstants(doc *goquery.Document) *goquery.Selection

SelectInstants returns nodes to be considered for parsing Instants

func (*MyInstants) Trending

func (source *MyInstants) Trending() *InstantsPage

Trending return the MyInstants trending page

func (*MyInstants) URL

func (source *MyInstants) URL() string

URL returns the url for instants page source

type Source

type Source interface {
	URL() string
	Home() *InstantsPage
	Trending() *InstantsPage
	Recent() *InstantsPage
	Query(name string) *InstantsPage
	SelectInstants(*goquery.Document) *goquery.Selection
	MakeInstants(*goquery.Selection) []Instant
}

Source is a website provider of instants

Directories

Path Synopsis
Godeps
_workspace/src/github.com/PuerkitoBio/goquery
Package goquery implements features similar to jQuery, including the chainable syntax, to manipulate and query an HTML document.
Package goquery implements features similar to jQuery, including the chainable syntax, to manipulate and query an HTML document.
_workspace/src/github.com/andybalholm/cascadia
The cascadia package is an implementation of CSS selectors.
The cascadia package is an implementation of CSS selectors.
_workspace/src/github.com/davecgh/go-spew/spew
Package spew implements a deep pretty printer for Go data structures to aid in debugging.
Package spew implements a deep pretty printer for Go data structures to aid in debugging.
_workspace/src/github.com/pmezard/go-difflib/difflib
Package difflib is a partial port of Python difflib module.
Package difflib is a partial port of Python difflib module.
_workspace/src/github.com/stretchr/testify/assert
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
_workspace/src/golang.org/x/net/html
Package html implements an HTML5-compliant tokenizer and parser.
Package html implements an HTML5-compliant tokenizer and parser.
_workspace/src/golang.org/x/net/html/atom
Package atom provides integer codes (also known as atoms) for a fixed set of frequently occurring HTML strings: tag names and attribute keys such as "p" and "id".
Package atom provides integer codes (also known as atoms) for a fixed set of frequently occurring HTML strings: tag names and attribute keys such as "p" and "id".
_workspace/src/golang.org/x/net/html/charset
Package charset provides common text encodings for HTML documents.
Package charset provides common text encodings for HTML documents.

Jump to

Keyboard shortcuts

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