Torrent source discovery. Two backends feed a common source struct:
:apibay— ThePirateBay JSON API, for movies and live-action TV.:nyaa— Nyaa.si RSS, where practically all anime torrents live(fansub-group releases with absolute episode numbers).
Both go through the same release-name parsing, ranking, and magnet building, so the rest of the app (probe / resolve / play) doesn't care which found it.
Summary
Functions
Which of a title's other names are safe to accept, given its primary one.
Wrap a torrent already downloaded in the debrid account as a top-ranked source.
Query for an anime episode. Nyaa releases use absolute episode numbers and
fansub naming ([SubsPlease] Frieren - 12), so we drop any : subtitle and
append the (zero-padded) episode number as a plain search term.
Search for an anime episode, combining per-episode releases and whole-series batch/season packs (older shows like GTO exist mostly as batches). Per-episode results rank first (exact file); batches follow (RD selects the episode file). Deduped by infohash.
Query for an anime movie — just the cleaned title.
Query for an anime episode in Title S01E02 form. The streaming-rip groups
(ToonsHub, AnoZu, Yameii...) name episodes that way, and a bare Title 02
query barely matches them — for a show carried by those groups this is the
difference between one result and nine.
The sources at or below cap, order untouched.
True when the browser can decode this audio codec directly (no transcode needed).
Query for a live-action TV episode: Title S01E02.
Does this release name look like a season pack rather than one episode?
Pick one page of sources to probe, sampled across resolution tiers.
A title spelled the way indexers spell it: accents folded to plain letters and anything still outside ASCII dropped, because that is what uploaders type — "Amélie" is uploaded as "Amelie", and searching the accented form finds none of it. Falls back to the title unchanged when folding leaves nothing, as it does for a title written in another script.
Does this release name actually name this title?
Is this release at or below cap?
The resolution a release name claims, or nil when it doesn't say.
Highest picture first — the ladder a resolution ceiling is measured against.
Search for torrents. opts[:backend] is :apibay (default) or :nyaa.
Returns {:ok, [source]} sorted best-first.
Torrentio anime sources by Kitsu id — the anime-native path Torrentio
supports (kitsu:ID:EPISODE, absolute numbering). This is what brings the
big public/Russian trackers (Rutor etc.) into the anime flow that Nyaa and
AnimeTosho don't carry. {:ok, [source]}; {:ok, []} when no kitsu id.
Torrentio anime movie by Kitsu id.
Torrentio sources for a movie, by IMDb id (e.g. "tt2364582").
Torrentio sources for a TV episode, by IMDb id + season + episode.
True when a Jackett/Prowlarr Torznab endpoint is configured.
Functions
Which of a title's other names are safe to accept, given its primary one.
Regional titles are mostly a gift — a film uploaded as "Corredora" or "Le Fabuleux Destin d'Amélie Poulain" is still the film. But TMDB lists "The Runner" as the US title of a Greek 2026 film called Runner, and accepting that hands back every release of the other 2026 film called The Runner — the exact confusion this is all here to end.
So an alternative name that is the primary one plus or minus a leading article is dropped. It cannot be told apart from the neighbouring title, and the primary name is the one the user picked.
Wrap a torrent already downloaded in the debrid account as a top-ranked source.
Query for an anime episode. Nyaa releases use absolute episode numbers and
fansub naming ([SubsPlease] Frieren - 12), so we drop any : subtitle and
append the (zero-padded) episode number as a plain search term.
Search for an anime episode, combining per-episode releases and whole-series batch/season packs (older shows like GTO exist mostly as batches). Per-episode results rank first (exact file); batches follow (RD selects the episode file). Deduped by infohash.
Returns {:ok, sources, :episode | :series | :mixed}.
Query for an anime movie — just the cleaned title.
Query for an anime episode in Title S01E02 form. The streaming-rip groups
(ToonsHub, AnoZu, Yameii...) name episodes that way, and a bare Title 02
query barely matches them — for a show carried by those groups this is the
difference between one result and nine.
The sources at or below cap, order untouched.
True when the browser can decode this audio codec directly (no transcode needed).
Query for a live-action TV episode: Title S01E02.
Does this release name look like a season pack rather than one episode?
"Complete", "Season 2", a bare S01 with no episode after it, a 01-24 range.
Pick one page of sources to probe, sampled across resolution tiers.
Strictly taking the top of the ranking gives a wall of 2160p — someone
who wants 1080p would have to probe (and rate-limit) through every 4K
release before the first 1080p is even checked. Each page instead takes
the best few from each tier (3× 2160p, 3× 1080p, 1× 720p), backfilling
the remaining slots by overall rank. Returns {page, rest}; the page
keeps the overall ranking order, so cached/library releases still lead.
A title spelled the way indexers spell it: accents folded to plain letters and anything still outside ASCII dropped, because that is what uploaders type — "Amélie" is uploaded as "Amelie", and searching the accented form finds none of it. Falls back to the title unchanged when folding leaves nothing, as it does for a title written in another script.
Does this release name actually name this title?
2026 gave us both Runner and The Runner, and a text indexer asked for one hands back the other — every public source for "Runner 2026" is in fact The Runner. So the test is exact: the part of the name before the release year (or the SxxEyy tag, for a show) must BE the title. A leading article makes it a different film, not a near-enough match, which is the point.
titles is every name the title legitimately goes by — TMDB's own, plus
its original-language one, since a foreign release is named in its own
language and is still the right film. Any of them matching is a match.
Anything the name gives no grounds to judge is let through: no year or season tag in it, or titles that all normalise to nothing, as a Japanese one does. This is here to tell two titles apart, not to police naming.
Is this release at or below cap?
An untagged release passes. Most of a real list carries no resolution in the name, and a missing tag is not evidence of 4K — refusing them would throw away more than it protects.
The resolution a release name claims, or nil when it doesn't say.
Highest picture first — the ladder a resolution ceiling is measured against.
Search for torrents. opts[:backend] is :apibay (default) or :nyaa.
Returns {:ok, [source]} sorted best-first.
Torrentio anime sources by Kitsu id — the anime-native path Torrentio
supports (kitsu:ID:EPISODE, absolute numbering). This is what brings the
big public/Russian trackers (Rutor etc.) into the anime flow that Nyaa and
AnimeTosho don't carry. {:ok, [source]}; {:ok, []} when no kitsu id.
Torrentio anime movie by Kitsu id.
Torrentio sources for a movie, by IMDb id (e.g. "tt2364582").
Torrentio sources for a TV episode, by IMDb id + season + episode.
True when a Jackett/Prowlarr Torznab endpoint is configured.