Documentation
¶
Index ¶
- Constants
- func BuildJar(cfClearance []string, uid, pass string) []*http.Cookie
- type Client
- type Facet
- type FacetID
- type Item
- type Option
- type SearchRequest
- func (req *SearchRequest) All(ctx context.Context, cl *Client) ([]Torrent, error)
- func (req *SearchRequest) Cur() Torrent
- func (req *SearchRequest) Do(ctx context.Context, cl *Client) (*SearchResponse, error)
- func (req *SearchRequest) Err() error
- func (req *SearchRequest) Next(ctx context.Context, cl *Client) bool
- func (req *SearchRequest) WithAdded(added string) *SearchRequest
- func (req *SearchRequest) WithCategories(categories ...int) *SearchRequest
- func (req *SearchRequest) WithFacet(name string, values ...string) *SearchRequest
- func (req *SearchRequest) WithFacets(facets ...string) *SearchRequest
- func (req *SearchRequest) WithNextDelay(d time.Duration) *SearchRequest
- func (req *SearchRequest) WithOrder(order string) *SearchRequest
- func (req *SearchRequest) WithOrderBy(orderBy string) *SearchRequest
- func (req *SearchRequest) WithPage(page int) *SearchRequest
- type SearchResponse
- type Tags
- type Time
- type Torrent
Constants ¶
const ( FacetAdded = "added" FacetName = "name" FacetSeeders = "seeders" FacetSize = "size" FacetTags = "tags" )
Facet filter names.
const ( OrderAsc = "asc" OrderDesc = "desc" )
Order values.
const ( OrderByNameSort = "nameSort" OrderByAdded = "added" OrderByNumComments = "numComments" OrderBySize = "size" OrderByCompleted = "completed" OrderBySeeders = "seeders" OrderByLeechers = "leechers" )
OrderBy values.
const ( RangeLast2Weeks = "[NOW/HOUR-14DAYS TO NOW/HOUR+1HOUR]" RangeLastMonth = "[NOW/HOUR-1MONTH TO NOW/HOUR+1HOUR]" RangeLastWeek = "[NOW/HOUR-7DAYS TO NOW/HOUR+1HOUR]" RangeLast24Hours = "[NOW/MINUTE-24HOURS TO NOW/MINUTE+1MINUTE]" RangeLast48Hours = "[NOW/MINUTE-48HOURS TO NOW/MINUTE+1MINUTE]" RangeLast72Hours = "[NOW/MINUTE-72HOURS TO NOW/MINUTE+1MINUTE]" Seeders0to50 = "[0 TO 50]" Seeders200Plus = "[201 TO *]" Seeders50to200 = "[51 TO 200]" Size0to750MB = "[0 TO 786432000]" Size1_5GBto4_5GB = "[1610612736 TO 4831838208]" Size15GBPlus = "[16106127360 TO *]" Size4_5GBto15GB = "[4831838208 TO 16106127360]" Size750MBto1_5GB = "[786432000 TO 1610612736]" )
Facet filter values.
const ( CategoryMoviesCam = 8 CategoryMoviesTSTC = 9 CategoryMoviesDVDRipDVDScreener = 11 CategoryMoviesWebRip = 37 CategoryMoviesHDRip = 43 CategoryMoviesBluRayRip = 14 CategoryMoviesDVDR = 12 CategoryMoviesBluRay = 13 CategoryMovies4k = 47 CategoryMoviesBoxsets = 15 CategoryMoviesDocumentaries = 29 CategoryTVEpisodes = 26 CategoryTVEpisodesHD = 32 CategoryTVBoxsets = 27 CategoryGamesPC = 17 CategoryGamesMac = 42 CategoryGamesXbox = 18 CategoryGamesXbox360 = 19 CategoryGamesXboxOne = 40 CategoryGamesPS2 = 20 CategoryGamesPS3 = 21 CategoryGamesPS4 = 39 CategoryGamesPS5 = 49 CategoryGamesPSP = 22 CategoryGamesWii = 28 CategoryGamesNintendoDS = 30 CategoryGamesNintendoSwitch = 48 CategoryAppsPCISO = 23 CategoryAppsMac = 24 CategoryAppsMobile = 25 CategoryApps0Day = 33 CategoryEducation = 38 CategoryAnimationAnime = 34 CategoryAnimationCartoons = 35 CategoryBooksEbooks = 45 CategoryBooksComics = 46 CategoryMusicAudio = 31 CategoryMusicVideos = 16 CategoryForeignMovies = 36 CategoryForeignTVSeries = 44 )
Categories.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
Jar []*http.Cookie
Transport http.RoundTripper
UserAgent string
// contains filtered or unexported fields
}
Client is a TL client.
type Facet ¶
type Facet struct {
Items map[string]Item `json:"items,omitempty"`
Name string `json:"name,omitempty"`
Title string `json:"title,omitempty"`
Type string `json:"type,omitempty"`
}
Facet is a facet.
type FacetID ¶ added in v0.2.0
type FacetID struct {
Items map[string]int `json:"items,omitempty"`
Name string `json:"name,omitempty"`
Title string `json:"title,omitempty"`
Type string `json:"type,omitempty"`
}
FacetID is a facet id.
type Option ¶
type Option func(cl *Client)
Option is a TL client option.
func WithCreds ¶ added in v0.1.7
WithCreds is a TL client option to set the cf_clearance, tluid, and tlpass cookies used by the TL client.
func WithTransport ¶
func WithTransport(transport http.RoundTripper) Option
WithTransport is a TL client option to set the http transport used by the TL client.
func WithUserAgent ¶ added in v0.3.0
WithUserAgent is a TL client option to set the user agent used by the TL client.
type SearchRequest ¶
type SearchRequest struct {
Categories []int
Facets map[string]string
Query []string
Added string
OrderBy string
Order string
Page int
// contains filtered or unexported fields
}
SearchRequest is a search request.
func (*SearchRequest) Cur ¶ added in v0.2.0
func (req *SearchRequest) Cur() Torrent
Cur returns the search response cursor's current torrent. Returns the same value until Next is called. Panics if called prior to Next.
See Next for an overview of using this method.
func (*SearchRequest) Do ¶
func (req *SearchRequest) Do(ctx context.Context, cl *Client) (*SearchResponse, error)
Do executes the request against the client.
func (*SearchRequest) Err ¶ added in v0.2.0
func (req *SearchRequest) Err() error
Err returns the last error in the search response.
See Next for an overview of using this method.
func (*SearchRequest) Next ¶ added in v0.2.0
func (req *SearchRequest) Next(ctx context.Context, cl *Client) bool
Next returns true if there are search results available for the request.
Example:
req := tlapi.Search()
for req.Next(ctx, cl) {
torrent := req.NextTorrent()
/* ... */
}
if err := req.Err(); err != nil {
/* ... */
}
func (*SearchRequest) WithAdded ¶ added in v0.1.5
func (req *SearchRequest) WithAdded(added string) *SearchRequest
WithAdded sets the search added filter.
func (*SearchRequest) WithCategories ¶
func (req *SearchRequest) WithCategories(categories ...int) *SearchRequest
WithCategories adds search category filters.
func (*SearchRequest) WithFacet ¶ added in v0.1.6
func (req *SearchRequest) WithFacet(name string, values ...string) *SearchRequest
WithFacet adds a single search facet name filter, joining values with a ','.
func (*SearchRequest) WithFacets ¶
func (req *SearchRequest) WithFacets(facets ...string) *SearchRequest
WithFacets adds search facet filters as string pairs (name, value...).
func (*SearchRequest) WithNextDelay ¶ added in v0.2.0
func (req *SearchRequest) WithNextDelay(d time.Duration) *SearchRequest
WithNextDelay sets the next delay, for use if user class is rate limited.
func (*SearchRequest) WithOrder ¶ added in v0.1.5
func (req *SearchRequest) WithOrder(order string) *SearchRequest
WithOrder sets the search order parameter (see Order constants).
func (*SearchRequest) WithOrderBy ¶ added in v0.1.5
func (req *SearchRequest) WithOrderBy(orderBy string) *SearchRequest
WithOrderBy sets the search orderBy parameter (see OrderBy constants).
func (*SearchRequest) WithPage ¶ added in v0.1.2
func (req *SearchRequest) WithPage(page int) *SearchRequest
WithPage sets the search page filter.
type SearchResponse ¶
type SearchResponse struct {
Facets struct {
CategoryID FacetID `json:"categoryID"`
Added Facet `json:"added"`
Name Facet `json:"name"`
Seeders Facet `json:"seeders"`
Size Facet `json:"size"`
Tags Tags `json:"tags"`
} `json:"facets"`
Facetswoc map[string]Tags `json:"facetswoc,omitempty"`
LastBrowseTime Time `json:"lastBrowseTime"`
NumFound int `json:"numFound,omitempty"`
OrderBy string `json:"orderBy,omitempty"`
Order string `json:"order,omitempty"`
Page int `json:"page,omitempty"`
PerPage int `json:"perPage,omitempty"`
TorrentList []Torrent `json:"torrentList,omitempty"`
UserTimeZone string `json:"userTimeZone,omitempty"`
}
SearchResponse is a search response.
type Tags ¶
type Tags struct {
Items map[string]int `json:"items,omitempty"`
Name string `json:"name,omitempty"`
Title string `json:"title,omitempty"`
Type string `json:"type,omitempty"`
}
Tags are tags.
type Time ¶
Time is a time value.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON satisfies the json.Unmarshaler interface.
type Torrent ¶
type Torrent struct {
AddedTimestamp time.Time `json:"addedTimestamp"`
CategoryID int `json:"categoryID,omitempty"`
Completed int `json:"completed,omitempty"`
DownloadMultiplier int `json:"download_multiplier,omitempty"`
ID int `json:"id,omitempty"`
Filename string `json:"filename,omitempty"`
Genres []string `json:"genres,omitempty"`
IgdbID string `json:"igdbID,omitempty"`
AnimeID string `json:"animeID,omitempty"`
ImdbID string `json:"imdbID,omitempty"`
Leechers int `json:"leechers,omitempty"`
Name string `json:"name,omitempty"`
New bool `json:"new,omitempty"`
NumComments int `json:"numComments,omitempty"`
Rating float64 `json:"rating,omitempty"`
Seeders int `json:"seeders,omitempty"`
Size int64 `json:"size,omitempty"`
Tags []string `json:"tags,omitempty"`
TvmazeID string `json:"tvmazeID,omitempty"`
Uploader string `json:"uploader,omitempty"`
CommentsDisabled int `json:"commentsDisabled,omitempty"`
}
Torrent is a torrent.
func (*Torrent) UnmarshalJSON ¶ added in v0.1.3
UnmarshalJSON satisfies the json.Unmarshaler interface.