Documentation
¶
Overview ¶
Package torrentapi provides simple and easy Golang interface for RARBG Torrent API v2 (https://torrentapi.org)
Index ¶
- Constants
- type API
- func (a *API) Category(category int) *API
- func (a *API) Format(format string) *API
- func (a *API) Limit(limit int) *API
- func (a *API) MinLeechers(minLeech int) *API
- func (a *API) MinSeeders(minSeed int) *API
- func (a *API) Ranked(ranked bool) *API
- func (a *API) Search() ([]TorrentResult, error)
- func (a *API) SearchString(query string) *API
- func (a *API) Sort(sort string) *API
- type APIResponse
- type Option
- type Token
- type TorrentResult
Constants ¶
const ( // Version of supported torrentapi. Version = 2.0 // DefaultAPIURL is a default value for APIURL option. DefaultAPIURL = "https://torrentapi.org/pubapi_v2.php?" // Defaulta.tokenExpiration is a default value for TokenExpiration option // (TorrentAPI exprires after 15 min, but let's expire it after 890 seconds // just to be safe. DefaultTokenExpiration = time.Second * 890 // DefaultRequestDelay is a default delay between requests. DefaultRequestDelay = time.Second * 2 // DefaultMaxRetries is a default value for MaxRetries option. DefaultMaxRetries = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
API provides interface to access Torrent API.
func (*API) Format ¶
Format requests different results format, possible values json, json_extended. Please note that whith json format not all fields are populated in TorrentResult.
func (*API) MinLeechers ¶
MinLeechers specify minimum number of leechers.
func (*API) MinSeeders ¶
MinSeeders specify minimum number of seeders.
func (*API) Search ¶
func (a *API) Search() ([]TorrentResult, error)
Search performs search, this has to be last function in chain.
func (*API) SearchString ¶
SearchString adds search string to search query.
type APIResponse ¶
type APIResponse struct { Error string Error_Code int Torrent_Results json.RawMessage }
APIResponse from Torrent API.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is an interface used to set various options for API.
type TorrentResult ¶
type TorrentResult struct { Category string Download string Filename string Info_Page string Leechers int PubDate string Ranked int Seeders int Size uint64 Title string }
TorrentResult keeps information about single torrent returned from TorrentAPI. Some of the fields may be empty.