Skip to content

Torrent Extension ​

Torrent extensions extend Torrent and give episode sources for anime that is already in the app. They can't add new content.

The only base method shared is getFilters().

Example ​

js
class MyTorrent extends Torrent {

    async search(query, filters, page) {
        return [
            {
                id: "",
                title: "Naruto",
                magnet: null,
                size: null,
                seeders: null,
                leechers: null,
                isBatch: false
            }
        ];
    }

    async getMagnet(id) {
        return "magnet:?xt=urn:btih:...";
    }
}

search(query, filters, page) ​

Besides your own filters, filters always includes the IDs of the anime being watched:

js
{
    ids: { anilist: "21", mal: "21", kitsu: "12" }, // only the ones Hoshi knows
    episode: 5,
    movie: false
}

Use them for ID-based lookups, and set exact_results in the manifest if your results are already for the requested episode.

Each result needs id and title. Everything else is optional, but the more you fill in, the better Hoshi can pick a release for the user. Results are checked against these types, and a wrong type (e.g. seeders: "5") fails the whole search:

FieldTypeDescription
magnetstringMagnet URI. If missing, getMagnet() is called
urlstringDirect http(s) link to the video (e.g. debrid). Played directly, without a torrent
infoHashstringTorrent info hash
sizestringHuman-readable size, e.g. "1.4 GB"
sizeBytesnumberSize in bytes
seeders / leechersnumberPeer counts
isBatchbooleantrue if it contains several episodes
releaseGroupstringe.g. "SubsPlease"
resolutionstringe.g. "1080p"
episodeNumbernumberEpisode the result is for
datestringRelease date

getMagnet(id) ​

This function only gets called if the search result does not return the magnet. It must return a magnet: URI.


Full template
js
class MyTorrent extends Torrent {

    async search(query, filters, page) {
        return [
            {
                id: "",
                title: "",
                magnet: null,
                size: null,
                seeders: null,
                leechers: null,
                isBatch: false
            }
        ];
    }

    async getMagnet(id) {
        return "magnet:?xt=urn:btih:...";
    }
}