yts

package module
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 12 Imported by: 0

README

yflicks-yts

YTS API client library for the yflicks desktop application

Documentation

Index

Constants

View Source
const (
	APIBaseURL = "https://yts.mx/api/v2"
	SiteURL    = "https://yts.mx"
)

Variables

This section is empty.

Functions

func DefaultTorrentTrackerList added in v0.8.2

func DefaultTorrentTrackerList() []string

Types

type BaseResponse

type BaseResponse struct {
	Status        string `json:"status"`
	StatusMessage string `json:"status_message"`
	Meta          `json:"@meta"`
}

type Cast

type Cast struct {
	Name          string `json:"name"`
	CharacterName string `json:"character_name"`
	ImdbCode      string `json:"imdb_code"`
	URLSmallImage string `json:"url_small_image"`
}

type Client

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

func NewClient

func NewClient(timeout time.Duration) *Client

func (Client) GetHomePageContent added in v0.8.0

func (c Client) GetHomePageContent(ctx context.Context) (
	*HomePageContentResponse, error,
)

func (Client) GetMovieDetails

func (c Client) GetMovieDetails(ctx context.Context, filters *MovieDetailsFilters) (
	*MovieDetailsResponse, error,
)

func (Client) GetMovieSuggestions

func (c Client) GetMovieSuggestions(ctx context.Context, movieID int) (
	*MovieSuggestionsResponse, error,
)

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 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"
)

func GetGenreList added in v0.7.2

func GetGenreList() []Genre

type HomePageContentData added in v0.8.0

type HomePageContentData struct {
	Popular  []ScrapedMovie
	Latest   []ScrapedMovie
	Upcoming []ScrapedUpcomingMovie
}

type HomePageContentResponse added in v0.8.0

type HomePageContentResponse struct {
	Data HomePageContentData `json:"data"`
}

type Meta

type Meta struct {
	ServerTime     int    `json:"server_time"`
	ServerTimezone string `json:"server_timezone"`
	APIVersion     int    `json:"api_version"`
	ExecutionTime  string `json:"execution_time"`
}

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 {
	MovieID    int  `json:"movie_id"    validate:"required,min=1"`
	WithImages bool `json:"with_images" validate:"boolean"`
	WithCast   bool `json:"with_cast"   validate:"boolean"`
}

func DefaultMovieDetailsFilters

func DefaultMovieDetailsFilters(movieID int) *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) GetMagnet added in v0.8.2

func (mp *MoviePartial) GetMagnet(q Quality) (string, error)

type MovieSuggestionsData

type MovieSuggestionsData struct {
	MovieCount int     `json:"movie_count"`
	Movies     []Movie `json:"movies"`
}

type MovieSuggestionsResponse

type MovieSuggestionsResponse struct {
	BaseResponse
	Data MovieSuggestionsData `json:"data"`
}

type OrderBy added in v0.8.2

type OrderBy string
const (
	OrderByAsc  OrderBy = "asc"
	OrderByDesc OrderBy = "desc"
)

func GetOrderByList added in v0.7.2

func GetOrderByList() []OrderBy

type Quality added in v0.8.2

type Quality string
const (
	QualityAll       Quality = "All"
	Quality480p      Quality = "480p"
	Quality720p      Quality = "720p"
	Quality1080p     Quality = "1080p"
	Quality1080pX265 Quality = "1080p.x265"
	Quality2160p     Quality = "2160p"
	Quality3D        Quality = "3D"
)

func GetQualityList added in v0.8.2

func GetQualityList() []Quality

type ScrapedMovie added in v0.8.0

type ScrapedMovie struct {
	Title  string `json:"title"`
	Year   int    `json:"year"`
	Link   string `json:"link"`
	Image  string `json:"image"`
	Rating string `json:"rating"`
}

type ScrapedUpcomingMovie added in v0.8.0

type ScrapedUpcomingMovie struct {
	ScrapedMovie
	Progress int `json:"progress"`
}

type SearchMoviesData

type SearchMoviesData struct {
	MovieCount int     `json:"movie_count"`
	Limit      int     `json:"limit"`
	PageNumber int     `json:"page_number"`
	Movies     []Movie `json:"movies"`
}

type SearchMoviesFilters

type SearchMoviesFilters struct {
	Limit         int    `json:"limit"           validate:"min=1,max=50"`
	Page          int    `json:"page"            validate:"min=1"`
	Quality       string `json:"quality"         validate:"oneof=all 480p 720p 1080p 1080p.x265 2160p 3D"`
	MinimumRating int    `json:"minimum_rating"  validate:"min=0,max=9"`
	QueryTerm     string `json:"query_term"`
	Genre         string `` /* 251-byte string literal not displayed */
	SortBy        string `json:"sort_by"         validate:"oneof=title year rating peers seeds download_count like_count date_added"`
	OrderBy       string `json:"order_by"        validate:"oneof=asc desc"`
	WithRTRatings bool   `json:"with_rt_ratings" validate:"boolean"`
}

func DefaultSearchMoviesFilter

func DefaultSearchMoviesFilter() *SearchMoviesFilters

type SearchMoviesResponse

type SearchMoviesResponse struct {
	BaseResponse
	Data SearchMoviesData `json:"data"`
}

type SortBy added in v0.8.2

type SortBy string
const (
	SortByTitle         SortBy = "title"
	SortByYear          SortBy = "year"
	SortByRating        SortBy = "rating"
	SortByPeers         SortBy = "peers"
	SortBySeeds         SortBy = "seeds"
	SortByDownloadCount SortBy = "download_count"
	SortByLikeCount     SortBy = "like_count"
	SortByDateAdded     SortBy = "date_added"
)

func GetSortByList added in v0.7.2

func GetSortByList() []SortBy

type StructValidationError added in v0.7.0

type StructValidationError struct {
	Struct   string
	Field    string
	Tag      string
	Value    interface{}
	Expected string
}

func (*StructValidationError) Error added in v0.7.0

func (e *StructValidationError) Error() string

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 TrendingMoviesData added in v0.8.0

type TrendingMoviesData struct {
	Movies []ScrapedMovie `json:"movies"`
}

type TrendingMoviesResponse added in v0.8.0

type TrendingMoviesResponse struct {
	Data TrendingMoviesData `json:"data"`
}

Jump to

Keyboard shortcuts

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