ptp

package
v1.56.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultURL = "https://passthepopcorn.me/torrents.php"

Variables

View Source
var ErrForbidden = errors.New("forbidden")
View Source
var ErrTooManyRequests = errors.New("too many requests: rate-limit reached")
View Source
var ErrUnauthorized = errors.New("unauthorized: bad credentials")

Functions

This section is empty.

Types

type ApiClient

type ApiClient interface {
	GetTorrentByID(ctx context.Context, torrentID string) (*domain.TorrentBasic, error)
	TestAPI(ctx context.Context) (bool, error)
}

func NewClient

func NewClient(apiUser, apiKey string, opts ...OptFunc) ApiClient

type Client

type Client struct {
	APIUser string
	APIKey  string
	// contains filtered or unexported fields
}

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) GetTorrentByID

func (c *Client) GetTorrentByID(ctx context.Context, torrentID string) (*domain.TorrentBasic, error)

func (*Client) GetTorrents added in v1.46.0

func (c *Client) GetTorrents(ctx context.Context) (*TorrentListResponse, error)

func (*Client) TestAPI

func (c *Client) TestAPI(ctx context.Context) (bool, error)

TestAPI try api access against torrents page

type Director added in v1.46.0

type Director struct {
	Name string `json:"Name"`
	ID   string `json:"Id"`
}

type Movie added in v1.46.0

type Movie struct {
	GroupID        string     `json:"GroupId"`
	Title          string     `json:"Title"`
	Year           string     `json:"Year"`
	Cover          string     `json:"Cover"`
	Tags           []string   `json:"Tags"`
	Directors      []Director `json:"Directors,omitempty"`
	ImdbID         *string    `json:"ImdbId,omitempty"`
	LastUploadTime string     `json:"LastUploadTime"`
	MaxSize        int64      `json:"MaxSize"`
	TotalSnatched  int64      `json:"TotalSnatched"`
	TotalSeeders   int64      `json:"TotalSeeders"`
	TotalLeechers  int64      `json:"TotalLeechers"`
	Torrents       []Torrent  `json:"Torrents"`
}

type OptFunc added in v1.35.0

type OptFunc func(*Client)

func WithUrl added in v1.35.0

func WithUrl(url string) OptFunc

type Torrent

type Torrent struct {
	Id            string  `json:"Id"`
	InfoHash      string  `json:"InfoHash"`
	Quality       string  `json:"Quality"`
	Source        string  `json:"Source"`
	Container     string  `json:"Container"`
	Codec         string  `json:"Codec"`
	Resolution    string  `json:"Resolution"`
	Size          string  `json:"Size"`
	Scene         bool    `json:"Scene"`
	UploadTime    string  `json:"UploadTime"`
	Snatched      string  `json:"Snatched"`
	Seeders       string  `json:"Seeders"`
	Leechers      string  `json:"Leechers"`
	ReleaseName   string  `json:"ReleaseName"`
	ReleaseGroup  *string `json:"ReleaseGroup"`
	Checked       bool    `json:"Checked"`
	GoldenPopcorn bool    `json:"GoldenPopcorn"`
	FreeleechType *string `json:"FreeleechType,omitempty"`
	RemasterTitle *string `json:"RemasterTitle,omitempty"`
	RemasterYear  *string `json:"RemasterYear,omitempty"`
}

func (*Torrent) UnmarshalJSON added in v1.48.0

func (t *Torrent) UnmarshalJSON(data []byte) error

custom unmarshal method for Torrent

type TorrentListResponse added in v1.46.0

type TorrentListResponse struct {
	TotalResults string  `json:"TotalResults"`
	Movies       []Movie `json:"Movies"`
	Page         string  `json:"Page"`
}

type TorrentResponse

type TorrentResponse struct {
	Page          string    `json:"Page"`
	Result        string    `json:"Result"`
	GroupId       string    `json:"GroupId"`
	Name          string    `json:"Name"`
	Year          string    `json:"Year"`
	CoverImage    string    `json:"CoverImage"`
	AuthKey       string    `json:"AuthKey"`
	PassKey       string    `json:"PassKey"`
	TorrentId     string    `json:"TorrentId"`
	ImdbId        string    `json:"ImdbId"`
	ImdbRating    string    `json:"ImdbRating"`
	ImdbVoteCount int       `json:"ImdbVoteCount"`
	Torrents      []Torrent `json:"Torrents"`
}

Jump to

Keyboard shortcuts

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