Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultTorrentTrackers() []string
- type BaseResponse
- type Cast
- type Client
- func (c *Client) GetHomePageContent(ctx context.Context) (*HomePageContentResponse, error)
- func (c *Client) GetMagnetLinks(t TorrentInfoGetter) TorrentMagnets
- func (c *Client) GetMovieDetails(ctx context.Context, movieID int, filters *MovieDetailsFilters) (*MovieDetailsResponse, error)
- func (c *Client) GetMovieSuggestions(ctx context.Context, movieID int) (*MovieSuggestionsResponse, error)
- func (c *Client) GetTrendingMovies(ctx context.Context) (*TrendingMoviesResponse, error)
- func (c *Client) SearchMovies(ctx context.Context, filters *SearchMoviesFilters) (*SearchMoviesResponse, error)
- type ClientConfig
- type Genre
- type HomePageContentData
- type HomePageContentResponse
- type Meta
- type Movie
- type MovieDetails
- type MovieDetailsData
- type MovieDetailsFilters
- type MovieDetailsResponse
- type MoviePartial
- type MovieSuggestionsData
- type MovieSuggestionsResponse
- type OrderBy
- type Quality
- type SearchMoviesData
- type SearchMoviesFilters
- type SearchMoviesResponse
- type SiteMovie
- type SiteMovieBase
- type SiteUpcomingMovie
- type SortBy
- type Torrent
- type TorrentInfo
- type TorrentInfoGetter
- type TorrentMagnets
- type TrendingMoviesData
- type TrendingMoviesResponse
Constants ¶
View Source
const ( DefaultAPIBaseURL = "https://yts.mx/api/v2" DefaultSiteURL = "https://yts.mx" DefaultSiteDomain = "yts.mx" )
View Source
const ( TimeoutLimitUpper = 5 * time.Minute TimeoutLimitLower = 5 * time.Second )
Variables ¶
View Source
var ( ErrContentRetrievalFailure = errors.New("content_retrieval_failure") ErrFilterValidationFailure = errors.New("filter_validation_failure") )
View Source
var ErrInvalidClientTimeout = fmt.Errorf( `invalid_client_timeout: "yts client timeout must be between %s and %s inclusive"`, TimeoutLimitLower, TimeoutLimitUpper, )
Functions ¶
func DefaultTorrentTrackers ¶ added in v0.9.0
func DefaultTorrentTrackers() []string
Types ¶
type BaseResponse ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithConfig ¶ added in v0.9.0
func NewClientWithConfig(config *ClientConfig) *Client
func (*Client) GetHomePageContent ¶ added in v0.8.0
func (c *Client) GetHomePageContent(ctx context.Context) ( *HomePageContentResponse, error, )
func (*Client) GetMagnetLinks ¶ added in v0.9.1
func (c *Client) GetMagnetLinks(t TorrentInfoGetter) TorrentMagnets
func (*Client) GetMovieDetails ¶
func (c *Client) GetMovieDetails(ctx context.Context, movieID int, filters *MovieDetailsFilters) ( *MovieDetailsResponse, error, )
func (*Client) GetMovieSuggestions ¶
func (*Client) GetTrendingMovies ¶ added in v0.8.0
func (c *Client) GetTrendingMovies(ctx context.Context) ( *TrendingMoviesResponse, error, )
func (*Client) SearchMovies ¶
func (c *Client) SearchMovies(ctx context.Context, filters *SearchMoviesFilters) ( *SearchMoviesResponse, error, )
type ClientConfig ¶ added in v0.9.0
type ClientConfig struct {
APIBaseURL string
SiteURL string
SiteDomain string
TorrentTrackers []string
RequestTimeout time.Duration
Debug bool
}
func DefaultClientConfig ¶ added in v0.9.0
func DefaultClientConfig() ClientConfig
type Genre ¶ added in v0.8.2
type Genre string
const ( GenreAll Genre = "all" GenreAction Genre = "Action" GenreAdventure Genre = "Adventure" GenreAnimation Genre = "Animation" GenreBiography Genre = "Biography" GenreComedy Genre = "Comedy" GenreCrime Genre = "Crime" GenreDocumentary Genre = "Documentary" GenreDrama Genre = "Drama" GenreFamily Genre = "Family" GenreFantasy Genre = "Fantasy" GenreFilmNoir Genre = "Film-Noir" GenreGameShow Genre = "Game-Show" GenreHistory Genre = "History" GenreHorror Genre = "Horror" GenreMusic Genre = "Music" GenreMusical Genre = "Musical" GenreMystery Genre = "Mystery" GenreNews Genre = "News" GenreRealityTV Genre = "Reality-TV" GenreRomance Genre = "Romance" GenreSciFi Genre = "Sci-Fi" GenreSport Genre = "Sport" GenreTalkShow Genre = "Talk-show" GenreThriller Genre = "Thriller" GenreWar Genre = "War" GenreWestern Genre = "Western" )
type HomePageContentData ¶ added in v0.8.0
type HomePageContentData struct {
Popular []SiteMovie
Latest []SiteMovie
Upcoming []SiteUpcomingMovie
}
type HomePageContentResponse ¶ added in v0.8.0
type HomePageContentResponse struct {
Data HomePageContentData `json:"data"`
}
type Movie ¶
type Movie struct {
MoviePartial
Summary string `json:"summary"`
Synopsis string `json:"synopsis"`
State string `json:"state"`
}
type MovieDetails ¶
type MovieDetails struct {
MoviePartial
LikeCount int `json:"like_count"`
DescriptionIntro string `json:"description_intro"`
MediumScreenshotImage1 string `json:"medium_screenshot_image1"`
MediumScreenshotImage2 string `json:"medium_screenshot_image2"`
MediumScreenshotImage3 string `json:"medium_screenshot_image3"`
LargeScreenshotImage1 string `json:"large_screenshot_image1"`
LargeScreenshotImage2 string `json:"large_screenshot_image2"`
LargeScreenshotImage3 string `json:"large_screenshot_image3"`
Cast []Cast `json:"cast"`
}
type MovieDetailsData ¶
type MovieDetailsData struct {
Movie MovieDetails `json:"movie"`
}
type MovieDetailsFilters ¶
type MovieDetailsFilters struct {
WithImages bool `json:"with_images"`
WithCast bool `json:"with_cast"`
}
func DefaultMovieDetailsFilters ¶
func DefaultMovieDetailsFilters() *MovieDetailsFilters
type MovieDetailsResponse ¶
type MovieDetailsResponse struct {
BaseResponse
Data MovieDetailsData `json:"data"`
}
type MoviePartial ¶
type MoviePartial struct {
ID int `json:"id"`
URL string `json:"url"`
ImdbCode string `json:"imdb_code"`
Title string `json:"title"`
TitleEnglish string `json:"title_english"`
TitleLong string `json:"title_long"`
Slug string `json:"slug"`
Year int `json:"year"`
Rating float64 `json:"rating"`
Runtime int `json:"runtime"`
Genres []Genre `json:"genres"`
DescriptionFull string `json:"description_full"`
YtTrailerCode string `json:"yt_trailer_code"`
Language string `json:"language"`
MpaRating string `json:"mpa_rating"`
BackgroundImage string `json:"background_image"`
BackgroundImageOriginal string `json:"background_image_original"`
SmallCoverImage string `json:"small_cover_image"`
MediumCoverImage string `json:"medium_cover_image"`
LargeCoverImage string `json:"large_cover_image"`
Torrents []Torrent `json:"torrents"`
DateUploaded string `json:"date_uploaded"`
DateUploadedUnix int `json:"date_uploaded_unix"`
}
func (*MoviePartial) GetTorrentInfo ¶ added in v0.9.0
func (mp *MoviePartial) GetTorrentInfo() *TorrentInfo
type MovieSuggestionsData ¶
type MovieSuggestionsResponse ¶
type MovieSuggestionsResponse struct {
BaseResponse
Data MovieSuggestionsData `json:"data"`
}
type SearchMoviesData ¶
type SearchMoviesFilters ¶
type SearchMoviesFilters struct {
Limit int `json:"limit"`
Page int `json:"page"`
Quality Quality `json:"quality"`
MinimumRating int `json:"minimum_rating"`
QueryTerm string `json:"query_term"`
Genre Genre `json:"genre"`
SortBy SortBy `json:"sort_by"`
OrderBy OrderBy `json:"order_by"`
WithRTRatings bool `json:"with_rt_ratings"`
}
func DefaultSearchMoviesFilter ¶
func DefaultSearchMoviesFilter(query string) *SearchMoviesFilters
type SearchMoviesResponse ¶
type SearchMoviesResponse struct {
BaseResponse
Data SearchMoviesData `json:"data"`
}
type SiteMovie ¶ added in v0.9.0
type SiteMovie struct {
SiteMovieBase
Rating string `json:"rating"`
}
type SiteMovieBase ¶ added in v0.9.0
type SiteUpcomingMovie ¶ added in v0.9.0
type SiteUpcomingMovie struct {
SiteMovieBase
Progress int `json:"progress"`
Quality Quality `json:"quality"`
}
type Torrent ¶
type Torrent struct {
URL string `json:"url"`
Hash string `json:"hash"`
Quality Quality `json:"quality"`
Type string `json:"type"`
IsRepack string `json:"is_repack"`
VideoCodec string `json:"video_codec"`
BitDepth string `json:"bit_depth"`
AudioChannels string `json:"audio_channels"`
Seeds int `json:"seeds"`
Peers int `json:"peers"`
Size string `json:"size"`
SizeBytes int `json:"size_bytes"`
DateUploaded string `json:"date_uploaded"`
DateUploadedUnix int `json:"date_uploaded_unix"`
}
type TorrentInfo ¶ added in v0.9.0
type TorrentInfoGetter ¶ added in v0.9.0
type TorrentInfoGetter interface {
GetTorrentInfo() *TorrentInfo
}
type TorrentMagnets ¶ added in v0.9.1
type TrendingMoviesData ¶ added in v0.8.0
type TrendingMoviesData struct {
Movies []SiteMovie `json:"movies"`
}
type TrendingMoviesResponse ¶ added in v0.8.0
type TrendingMoviesResponse struct {
Data TrendingMoviesData `json:"data"`
}
Click to show internal directories.
Click to hide internal directories.