Help us shape the future of Go! Take the 2026 Go Developer Survey

stremio

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package stremio searches Stremio stream addons for torrent releases.

A stream addon answers GET {base}/stream/{type}/{id}.json with streams for an IMDb title (type "movie", id "tt0816692") or episode (type "series", id "tt0903747:1:2"). Ether reads each stream's info hash, file name, size, seeders and any debrid cached marker, and streams the torrent through the owner's own debrid accounts; it never calls an addon's playback links. Ether ships no addon URLs: the owner pastes the install URL of an addon they chose, with or without the addon's own settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseURL

func BaseURL(raw string) (*url.URL, error)

BaseURL returns an addon's base URL from its install URL: a stremio:// link becomes https://, and a trailing /manifest.json or /configure is removed. The path keeps the addon's settings segment, if any.

Types

type AnimeIDs added in v0.2.44

type AnimeIDs interface {
	Lookup(ctx context.Context, req core.SearchRequest, db string) (id int64, episode int, ok bool, err error)
}

AnimeIDs maps a TMDB request to an anime database id (Kitsu, MAL, AniList, AniDB) for addons that look anime up only by those ids. Implemented by *animemap.Service.

type Backend

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

Backend is a newznab.Backend for one Stremio addon: the indexer Client keeps budgets, the result cache, rate-limit pauses and events around it.

func (*Backend) FetchNZB

func (b *Backend) FetchNZB(ctx context.Context, r core.Release, reserve func(context.Context, string) error) ([]byte, error)

FetchNZB implements newznab.Backend for an addon's Usenet streams: it downloads the stream's NZB. The addon's own origin is trusted (a self-hosted addon on the LAN); any other host, and every redirect hop, must be public. Errors name the host only. Whatever the server answers is transient (core.ErrSourceUnavailable): a login page or an oversized body today says nothing permanent about the release. Only a release without a usable NZB link is rejected (core.ErrReleaseRejected).

func (*Backend) ResolveTorrent

func (b *Backend) ResolveTorrent(_ context.Context, r core.Release, _ func(context.Context, string) error) (core.Release, error)

ResolveTorrent implements newznab.Backend. Every addon result already carries its info hash and magnet.

func (*Backend) Search

func (b *Backend) Search(ctx context.Context, req core.SearchRequest, reserve func(context.Context, string) error) ([]core.Release, error)

Search implements newznab.Backend. Movies are looked up by id and episodes by id, season and episode (lookupID: IMDb, else TMDB, else a mapped anime database id); a season-level request (Episode 0) asks for the season's first episode and keeps whole-season packs. Titles the addon cannot be asked about, and show-level requests, have no answer.

type Manifest

type Manifest struct {
	ID            string            `json:"id"`
	Name          string            `json:"name"`
	Version       string            `json:"version"`
	Types         []string          `json:"types"`
	IDPrefixes    []string          `json:"idPrefixes"`
	Resources     []json.RawMessage `json:"resources"`
	BehaviorHints struct {
		ConfigurationRequired bool `json:"configurationRequired"`
	} `json:"behaviorHints"`
}

Manifest is the part of an addon manifest Ether reads.

func FetchManifest

func FetchManifest(ctx context.Context, client *http.Client, rawURL string) (Manifest, error)

FetchManifest reads and checks the manifest of the addon at rawURL.

func (Manifest) Check

func (m Manifest) Check() error

Check reports why Ether cannot search the addon, or nil.

type Options added in v0.2.44

type Options struct {
	// Client talks to the owner-configured addon (20 s timeout when nil).
	Client *http.Client
	// NZBClient downloads the NZB files of Usenet streams. Its transport
	// must be a safefetch guard: only the addon's own origin may be a
	// private address. Nil builds one.
	NZBClient *http.Client
	// Anime maps TMDB ids to anime database ids; nil loads the community
	// mapping lazily, the first time an addon needs it.
	Anime AnimeIDs
}

Options configure a Service.

type Service

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

Service builds and keeps one Backend per configured addon, so a backend's manifest survives between searches.

func NewService

func NewService(client *http.Client) *Service

NewService returns a Service. client nil uses a default client with a 20 s timeout.

func NewServiceWithOptions added in v0.2.44

func NewServiceWithOptions(o Options) *Service

NewServiceWithOptions returns a Service built from o.

func (*Service) Backend

func (s *Service) Backend(cfg config.Indexer) (newznab.Backend, error)

Backend returns the backend for an addon indexer (newznab.Options.Backend).

func (*Service) Test

func (s *Service) Test(ctx context.Context, cfg config.Indexer) error

Test checks that the addon at cfg.URL can be searched.

Jump to

Keyboard shortcuts

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