Documentation
¶
Overview ¶
Package bhdapi provides a bhd client.
Index ¶
- type Bool
- type Client
- 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) PageIndex() (int, int)
- func (req SearchRequest) WithAlive(alive bool) *SearchRequest
- func (req SearchRequest) WithAudios(audios ...string) *SearchRequest
- func (req SearchRequest) WithCategories(categories ...string) *SearchRequest
- func (req SearchRequest) WithCompleted(completed bool) *SearchRequest
- func (req SearchRequest) WithCountries(countries ...string) *SearchRequest
- func (req SearchRequest) WithDead(dead bool) *SearchRequest
- func (req SearchRequest) WithDying(dying bool) *SearchRequest
- func (req SearchRequest) WithFeatures(features ...string) *SearchRequest
- func (req SearchRequest) WithFileName(fileName string) *SearchRequest
- func (req SearchRequest) WithFolderName(folderName string) *SearchRequest
- func (req SearchRequest) WithFreeleech(freeleech bool) *SearchRequest
- func (req SearchRequest) WithGenres(genres ...string) *SearchRequest
- func (req SearchRequest) WithGroups(groups ...string) *SearchRequest
- func (req SearchRequest) WithH264(h264 bool) *SearchRequest
- func (req SearchRequest) WithH265(h265 bool) *SearchRequest
- func (req SearchRequest) WithImdbID(imdbID string) *SearchRequest
- func (req SearchRequest) WithIncomplete(incomplete bool) *SearchRequest
- func (req SearchRequest) WithInfoHash(infoHash string) *SearchRequest
- func (req SearchRequest) WithLanguages(languages ...string) *SearchRequest
- func (req SearchRequest) WithLeeching(leeching bool) *SearchRequest
- func (req SearchRequest) WithLimited(limited bool) *SearchRequest
- func (req SearchRequest) WithMaxYear(maxYear int) *SearchRequest
- func (req SearchRequest) WithMinBHD(minBHD int) *SearchRequest
- func (req SearchRequest) WithMinImdb(minImdb int) *SearchRequest
- func (req SearchRequest) WithMinTmbd(minTmbd int) *SearchRequest
- func (req SearchRequest) WithMinYear(minYear int) *SearchRequest
- func (req SearchRequest) WithNotDownloaded(notDownloaded bool) *SearchRequest
- func (req SearchRequest) WithOrder(order string) *SearchRequest
- func (req SearchRequest) WithPack(pack bool) *SearchRequest
- func (req SearchRequest) WithPage(page int) *SearchRequest
- func (req SearchRequest) WithPromo25(promo25 bool) *SearchRequest
- func (req SearchRequest) WithPromo50(promo50 bool) *SearchRequest
- func (req SearchRequest) WithPromo75(promo75 bool) *SearchRequest
- func (req SearchRequest) WithRefund(refund bool) *SearchRequest
- func (req SearchRequest) WithRescue(rescue bool) *SearchRequest
- func (req SearchRequest) WithReseed(reseed bool) *SearchRequest
- func (req SearchRequest) WithRewind(rewind bool) *SearchRequest
- func (req SearchRequest) WithSD(sd bool) *SearchRequest
- func (req SearchRequest) WithSeeding(seeding bool) *SearchRequest
- func (req SearchRequest) WithSize(size int64) *SearchRequest
- func (req SearchRequest) WithSort(sort string) *SearchRequest
- func (req SearchRequest) WithSources(sources ...string) *SearchRequest
- func (req SearchRequest) WithStream(stream bool) *SearchRequest
- func (req SearchRequest) WithSubtitles(subtitles ...string) *SearchRequest
- func (req SearchRequest) WithTmdbID(tmdbID string) *SearchRequest
- func (req SearchRequest) WithTypes(types ...string) *SearchRequest
- func (req SearchRequest) WithUploadedBy(uploadedBy string) *SearchRequest
- func (req SearchRequest) WithVoteBHD(voteBHD int) *SearchRequest
- func (req SearchRequest) WithVoteImdb(voteImdb int) *SearchRequest
- func (req SearchRequest) WithVoteTmbd(voteTmbd int) *SearchRequest
- type SearchResponse
- type Time
- type Torrent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool bool
Bool is a bool type.
func (Bool) MarshalJSON ¶
MarshalJSON satisfies the json.Marshaler interface.
func (*Bool) UnmarshalJSON ¶
UnmarshalJSON satisfies the json.Unmarshaler interface.
type Client ¶
type Client struct {
AddRssKey bool
ApiKey string
RssKey string
Transport http.RoundTripper
// contains filtered or unexported fields
}
Client is a BHD client.
type Option ¶
type Option func(cl *Client)
Option is a BHD client option.
func WithApiKey ¶
WithApiKey is a client option to set the api key.
func WithRssKey ¶
WithApiKey is a client option to set the rss key.
func WithTransport ¶ added in v0.1.4
func WithTransport(transport http.RoundTripper) Option
WithTransport is a client option to set the http transport used.
type SearchRequest ¶
type SearchRequest struct {
// The torrent name. It does support !negative searching. Example: Christmas Movie
Search string `json:"search,omitempty"`
// The torrent info_hash. This is an exact match.
InfoHash string `json:"info_hash,omitempty"`
// The torrent folder name. This is an exact match.
FolderName string `json:"folder_name,omitempty"`
// The torrent included file names. This is an exact match.
FileName string `json:"file_name,omitempty"`
// The torrent size. This is an exact match.
Size int64 `json:"size,omitempty"`
// The uploaders username. Only non anonymous results will be returned.
UploadedBy string `json:"uploaded_by,omitempty"`
// The ID of the matching IMDB page.
ImdbID string `json:"imdb_id,omitempty"`
// The ID of the matching TMDB page.
TmdbID string `json:"tmdb_id,omitempty"`
// Any categories separated by comma(s). (TV, Movies)
Categories []string `json:"categories,omitempty"`
// Any types separated by comma(s). (BD Remux, 1080p, etc.)
Types []string `json:"types,omitempty"`
// Any sources separated by comma(s). (Blu-ray, WEB, DVD, etc.)
Sources []string `json:"sources,omitempty"`
// Any genres separated by comma(s). (Action, Anime, Stand-Up, Western, etc.)
Genres []string `json:"genres,omitempty"`
// Any internal release groups separated by comma(s). (FraMeSToR, BHDStudio, BeyondHD, RPG, iROBOT, iFT, ZR, MKVULTRA)
Groups []string `json:"groups,omitempty"`
// The torrent freeleech status. 1 = Must match.
Freeleech Bool `json:"freeleech,omitempty"`
// The torrent limited UL promo. 1 = Must match.
Limited Bool `json:"limited,omitempty"`
// The torrent 25% promo. 1 = Must match.
Promo25 Bool `json:"promo25,omitempty"`
// The torrent 50% promo. 1 = Must match.
Promo50 Bool `json:"promo50,omitempty"`
// The torrent 75% promo. 1 = Must match.
Promo75 Bool `json:"promo75,omitempty"`
// The torrent refund promo. 1 = Must match.
Refund Bool `json:"refund,omitempty"`
// The torrent rescue promo. 1 = Must match.
Rescue Bool `json:"rescue,omitempty"`
// The torrent rewind promo. 1 = Must match.
Rewind Bool `json:"rewind,omitempty"`
// The torrent Stream Optimized flag. 1 = Must match.
Stream Bool `json:"stream,omitempty"`
// The torrent SD flag. 1 = Must match.
SD Bool `json:"sd,omitempty"`
// The torrent TV pack flag. 1 = Must match.
Pack Bool `json:"pack,omitempty"`
// The torrent x264/h264 codec flag. 1 = Must match.
H264 Bool `json:"h_264,omitempty"`
// The torrent x265/h265 codec flag. 1 = Must match.
H265 Bool `json:"h_265,omitempty"`
// Any features separated by comma(s). (DV, HDR10, HDR10P, Commentary)
Features []string `json:"features,omitempty"`
// The torrent has at least 1 seeder. 1 = Must match.
Alive Bool `json:"alive,omitempty"`
// The torrent has less than 3 seeders. 1 = Must match.
Dying Bool `json:"dying,omitempty"`
// The torrent has no seeders. 1 = Must match.
Dead Bool `json:"dead,omitempty"`
// The torrent has no seeders and an active reseed request. 1 = Must match.
Reseed Bool `json:"reseed,omitempty"`
// The torrent is seeded by you. 1 = Must match.
Seeding Bool `json:"seeding,omitempty"`
// The torrent is being leeched by you. 1 = Must match.
Leeching Bool `json:"leeching,omitempty"`
// The torrent has been completed by you. 1 = Must match.
Completed Bool `json:"completed,omitempty"`
// The torrent has not been completed by you. 1 = Must match.
Incomplete Bool `json:"incomplete,omitempty"`
// The torrent has not been downloaded you. 1 = Must match.
NotDownloaded Bool `json:"notdownloaded,omitempty"`
// The minimum BHD rating.
MinBHD int `json:"min_bhd,omitempty"`
// The minimum number of BHD votes.
VoteBHD int `json:"vote_bhd,omitempty"`
// The minimum IMDb rating.
MinImdb int `json:"min_imdb,omitempty"`
// The minimum number of IMDb votes.
VoteImdb int `json:"vote_imdb,omitempty"`
// The minimum TMDb rating.
MinTmbd int `json:"min_tmdb,omitempty"`
// The minimum number of TDMb votes.
VoteTmbd int `json:"vote_tmdb,omitempty"`
// The earliest release year.
MinYear int `json:"min_year,omitempty"`
// The latest release year.
MaxYear int `json:"max_year,omitempty"`
// Any production countries separated by comma(s). (France, Japan, etc.)
Countries []string `json:"countries,omitempty"`
// Any spoken languages separated by comma(s). (French, English, etc.)
Languages []string `json:"languages,omitempty"`
// Any audio tracks separated by comma(s). (English, Japanese, etc.)
Audios []string `json:"audios,omitempty"`
// Any subtitles separated by comma(s). (Dutch, Finnish, Swedish, etc.)
Subtitles []string `json:"subtitles,omitempty"`
// Field to sort results by. (bumped_at, created_at, seeders, leechers, times_completed, size, name, imdb_rating, tmdb_rating, bhd_rating). Default is bumped_at
Sort string `json:"sort,omitempty"`
// The direction of the sort of results. (asc, desc). Default is desc
Order string `json:"order,omitempty"`
// The page number of the results. Only if the result set has more than 100 total matches.
Page int `json:"page,omitempty"`
// contains filtered or unexported fields
}
SearchRequest is a bhd search request.
func (*SearchRequest) Cur ¶ added in v0.2.1
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 search request against the client.
func (*SearchRequest) Err ¶ added in v0.2.1
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.1
func (req *SearchRequest) Next(ctx context.Context, cl *Client) bool
Next returns true if there are search results available for the request.
Example:
req := bhdapi.Search()
for req.Next(ctx, cl) {
torrent := req.Cur()
/* ... */
}
if err := req.Err(); err != nil {
/* ... */
}
func (*SearchRequest) PageIndex ¶ added in v0.2.3
func (req *SearchRequest) PageIndex() (int, int)
PageIndex returns the search response cursor page and index.
func (SearchRequest) WithAlive ¶
func (req SearchRequest) WithAlive(alive bool) *SearchRequest
WithAlive sets the search alive.
func (SearchRequest) WithAudios ¶
func (req SearchRequest) WithAudios(audios ...string) *SearchRequest
WithAudios sets the search audios.
func (SearchRequest) WithCategories ¶
func (req SearchRequest) WithCategories(categories ...string) *SearchRequest
WithCategories sets the search categories.
func (SearchRequest) WithCompleted ¶
func (req SearchRequest) WithCompleted(completed bool) *SearchRequest
WithCompleted sets the search completed.
func (SearchRequest) WithCountries ¶
func (req SearchRequest) WithCountries(countries ...string) *SearchRequest
WithCountries sets the search countries.
func (SearchRequest) WithDead ¶
func (req SearchRequest) WithDead(dead bool) *SearchRequest
WithDead sets the search dead.
func (SearchRequest) WithDying ¶
func (req SearchRequest) WithDying(dying bool) *SearchRequest
WithDying sets the search dying.
func (SearchRequest) WithFeatures ¶
func (req SearchRequest) WithFeatures(features ...string) *SearchRequest
WithFeatures sets the search features.
func (SearchRequest) WithFileName ¶
func (req SearchRequest) WithFileName(fileName string) *SearchRequest
WithFileName sets the search file name value.
func (SearchRequest) WithFolderName ¶
func (req SearchRequest) WithFolderName(folderName string) *SearchRequest
WithFolderName sets the search folder name value.
func (SearchRequest) WithFreeleech ¶
func (req SearchRequest) WithFreeleech(freeleech bool) *SearchRequest
WithFreeleech sets the search freeleech.
func (SearchRequest) WithGenres ¶
func (req SearchRequest) WithGenres(genres ...string) *SearchRequest
WithGenres sets the search genres.
func (SearchRequest) WithGroups ¶
func (req SearchRequest) WithGroups(groups ...string) *SearchRequest
WithGroups sets the search groups.
func (SearchRequest) WithH264 ¶
func (req SearchRequest) WithH264(h264 bool) *SearchRequest
WithH264 sets the search h264.
func (SearchRequest) WithH265 ¶
func (req SearchRequest) WithH265(h265 bool) *SearchRequest
WithH265 sets the search h265.
func (SearchRequest) WithImdbID ¶
func (req SearchRequest) WithImdbID(imdbID string) *SearchRequest
WithImdbID sets the search imdb id value.
func (SearchRequest) WithIncomplete ¶
func (req SearchRequest) WithIncomplete(incomplete bool) *SearchRequest
WithIncomplete sets the search incomplete.
func (SearchRequest) WithInfoHash ¶
func (req SearchRequest) WithInfoHash(infoHash string) *SearchRequest
WithInfoHash sets the search info hash value.
func (SearchRequest) WithLanguages ¶
func (req SearchRequest) WithLanguages(languages ...string) *SearchRequest
WithLanguages sets the search languages.
func (SearchRequest) WithLeeching ¶
func (req SearchRequest) WithLeeching(leeching bool) *SearchRequest
WithLeeching sets the search leeching.
func (SearchRequest) WithLimited ¶
func (req SearchRequest) WithLimited(limited bool) *SearchRequest
WithLimited sets the search limited.
func (SearchRequest) WithMaxYear ¶
func (req SearchRequest) WithMaxYear(maxYear int) *SearchRequest
WithMaxYear sets the search max year.
func (SearchRequest) WithMinBHD ¶
func (req SearchRequest) WithMinBHD(minBHD int) *SearchRequest
WithMinBHD sets the search min BHD value.
func (SearchRequest) WithMinImdb ¶
func (req SearchRequest) WithMinImdb(minImdb int) *SearchRequest
WithMinImdb sets the search min imdb.
func (SearchRequest) WithMinTmbd ¶
func (req SearchRequest) WithMinTmbd(minTmbd int) *SearchRequest
WithMinTmbd sets the search min tmbd.
func (SearchRequest) WithMinYear ¶
func (req SearchRequest) WithMinYear(minYear int) *SearchRequest
WithMinYear sets the search min year.
func (SearchRequest) WithNotDownloaded ¶
func (req SearchRequest) WithNotDownloaded(notDownloaded bool) *SearchRequest
WithNotDownloaded sets the search not downloaded.
func (SearchRequest) WithOrder ¶
func (req SearchRequest) WithOrder(order string) *SearchRequest
WithOrder sets the search order.
func (SearchRequest) WithPack ¶
func (req SearchRequest) WithPack(pack bool) *SearchRequest
WithPack sets the search pack.
func (SearchRequest) WithPage ¶
func (req SearchRequest) WithPage(page int) *SearchRequest
WithPage sets the search page.
func (SearchRequest) WithPromo25 ¶
func (req SearchRequest) WithPromo25(promo25 bool) *SearchRequest
WithPromo25 sets the search promo25.
func (SearchRequest) WithPromo50 ¶
func (req SearchRequest) WithPromo50(promo50 bool) *SearchRequest
WithPromo50 sets the search promo50.
func (SearchRequest) WithPromo75 ¶
func (req SearchRequest) WithPromo75(promo75 bool) *SearchRequest
WithPromo75 sets the search promo75.
func (SearchRequest) WithRefund ¶
func (req SearchRequest) WithRefund(refund bool) *SearchRequest
WithRefund sets the search refund.
func (SearchRequest) WithRescue ¶
func (req SearchRequest) WithRescue(rescue bool) *SearchRequest
WithRescue sets the search rescue.
func (SearchRequest) WithReseed ¶
func (req SearchRequest) WithReseed(reseed bool) *SearchRequest
WithReseed sets the search reseed.
func (SearchRequest) WithRewind ¶
func (req SearchRequest) WithRewind(rewind bool) *SearchRequest
WithRewind sets the search rewind.
func (SearchRequest) WithSD ¶
func (req SearchRequest) WithSD(sd bool) *SearchRequest
WithSd sets the search sd.
func (SearchRequest) WithSeeding ¶
func (req SearchRequest) WithSeeding(seeding bool) *SearchRequest
WithSeeding sets the search seeding.
func (SearchRequest) WithSize ¶
func (req SearchRequest) WithSize(size int64) *SearchRequest
WithSize sets the search size value.
func (SearchRequest) WithSort ¶
func (req SearchRequest) WithSort(sort string) *SearchRequest
WithSort sets the search sort.
func (SearchRequest) WithSources ¶
func (req SearchRequest) WithSources(sources ...string) *SearchRequest
WithSources sets the search sources.
func (SearchRequest) WithStream ¶
func (req SearchRequest) WithStream(stream bool) *SearchRequest
WithStream sets the search stream.
func (SearchRequest) WithSubtitles ¶
func (req SearchRequest) WithSubtitles(subtitles ...string) *SearchRequest
WithSubtitles sets the search subtitles.
func (SearchRequest) WithTmdbID ¶
func (req SearchRequest) WithTmdbID(tmdbID string) *SearchRequest
WithTmdbID sets the search tmdb id value.
func (SearchRequest) WithTypes ¶
func (req SearchRequest) WithTypes(types ...string) *SearchRequest
WithTypes sets the search types.
func (SearchRequest) WithUploadedBy ¶
func (req SearchRequest) WithUploadedBy(uploadedBy string) *SearchRequest
WithUploadedBy sets the search uploaded by value.
func (SearchRequest) WithVoteBHD ¶
func (req SearchRequest) WithVoteBHD(voteBHD int) *SearchRequest
WithVoteBHD sets the search vote BHD value.
func (SearchRequest) WithVoteImdb ¶
func (req SearchRequest) WithVoteImdb(voteImdb int) *SearchRequest
WithVoteImdb sets the search vote imdb.
func (SearchRequest) WithVoteTmbd ¶
func (req SearchRequest) WithVoteTmbd(voteTmbd int) *SearchRequest
WithVoteTmbd sets the search vote tmbd.
type SearchResponse ¶
type SearchResponse struct {
// The status code of the post request. (0 = Failed and 1 = Success)
StatusCode int `json:"status_code,omitempty"`
// The current page of results that you're on.
Page int `json:"page,omitempty"`
// The results that match your query.
Results []Torrent `json:"results,omitempty"`
// The total number of pages of results matching your query.
TotalPages int `json:"total_pages,omitempty"`
// The total number of results matching your query.
TotalResults int `json:"total_results,omitempty"`
// The status of the call. (True = Success, False = Error)
Success bool `json:"success,omitempty"`
// The status message.
StatusMessage string `json:"status_message,omitempty"`
}
SearchResponse is a bhd search response.
type Time ¶
Time is a time value.
func (Time) MarshalJSON ¶
MarshalJSON satisfies the json.Marshaler interface.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON satisfies the json.Unmarshaler interface.
type Torrent ¶ added in v0.1.6
type Torrent struct {
// The BHD ID.
ID int `json:"id,omitempty"`
// The name.
Name string `json:"name,omitempty"`
// The torrent folder name.
FolderName string `json:"folder_name,omitempty"`
// The torrent info_hash.
InfoHash string `json:"info_hash,omitempty"`
// The torrent size.
Size int64 `json:"size,omitempty"`
// The uploaders username.
UploadedBy string `json:"uploaded_by,omitempty"`
// The category.
Category string `json:"category,omitempty"`
// The type.
Type string `json:"type,omitempty"`
// The seeders.
Seeders int `json:"seeders,omitempty"`
// The leechers.
Leechers int `json:"leechers,omitempty"`
// The times completed.
TimesCompleted int `json:"times_completed,omitempty"`
// The ID of the matching IMDB page.
ImdbID string `json:"imdb_id,omitempty"`
// The ID of the matching TMDB page.
TmdbID string `json:"tmdb_id,omitempty"`
// The BHD rating.
BhdRating float64 `json:"bhd_rating,omitempty"`
// The TMDb rating.
TmdbRating float64 `json:"tmdb_rating,omitempty"`
// The IMDb rating.
ImdbRating float64 `json:"imdb_rating,omitempty"`
// The torrent TV pack flag.
TvPack Bool `json:"tv_pack,omitempty"`
// The torrent 25% promo.
Promo25 Bool `json:"promo25,omitempty"`
// The torrent 50% promo.
Promo50 Bool `json:"promo50,omitempty"`
// The torrent 75% promo.
Promo75 Bool `json:"promo75,omitempty"`
// The torrent freeleech status.
Freeleech Bool `json:"freeleech,omitempty"`
// The torrent rewind promo.
Rewind Bool `json:"rewind,omitempty"`
// The torrent refund promo.
Refund Bool `json:"refund,omitempty"`
// The torrent limited UL promo.
Limited Bool `json:"limited,omitempty"`
// The torrent rescue promo.
Rescue Bool `json:"rescue,omitempty"`
// DV is dolby vision feature.
DV Bool `json:"dv,omitempty"`
// HDR10 is HDR10 feature.
HDR10 Bool `json:"hdr10,omitempty"`
// HDR10P is HDR10+ feature.
HDR10P Bool `json:"hdr10+,omitempty"`
// HLG is HLG feature.
HLG Bool `json:"hlg,omitempty"`
// Commentary is commentary feature.
Commentary Bool `json:"commentary,omitempty"`
// Internal is internal feature.
Internal Bool `json:"internal,omitempty"`
// The bumped at time.
BumpedAt Time `json:"bumped_at,omitempty"`
// The created at time.
CreatedAt Time `json:"created_at,omitempty"`
// The url.
URL string `json:"url,omitempty"`
// The download url.
DownloadURL string `json:"download_url,omitempty"`
}
Torrent is a bhd torrent.