search

package
v0.0.0-...-02b6759 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

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

Aggregator aggregates search results from multiple Searchers

func (*Aggregator) AddSearcher

func (ag *Aggregator) AddSearcher(s Searcher)

AddSearcher adds a searcher to the aggregator. The caller must take care of not adding the save searcher multiple times.

func (Aggregator) Search

func (ag Aggregator) Search(query string) (Results, error)

Search performs a search using all searchers and aggregates the results removing any duplicates.

type Result

type Result struct {
	Name      string
	MagnetURL string
	Seeders   uint
	Size      uint64
}

Result is a single search result

type ResultFilterFunc

type ResultFilterFunc func(*Result) bool

ResultFilterFunc is used to filter a list of results

type Results

type Results []*Result

Results is a slice of search results

func (*Results) Filter

func (rs *Results) Filter(fun ResultFilterFunc) (out Results)

Filter creates a new results list using the filter function

func (*Results) Sort

func (rs *Results) Sort()

Sort sorts the result list

type Searcher

type Searcher interface {
	Search(query string) (Results, error)
}

Searcher can search for torrents

type Thepiratebay

type Thepiratebay struct {
}

Thepiratebay is a Searcher backed by The Pirate Bay

func (*Thepiratebay) Search

func (tpb *Thepiratebay) Search(query string) (results Results, err error)

Search performs a search

Jump to

Keyboard shortcuts

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