Simple library for interfacing with a torznab API.
Installation
Package is available on Haxelib.
haxelib install torznab
Usage
Get the API url and key of the Torznab endpoint. In the following example Jackett is used.
var client: TorznabClient = new TorznabClient('http://jackett:9117/api/v2.0/indexers/all/results/torznab', 'api key');
Note that all methods return tink_core promises. As such they are compatible with the rest of the tink framework. For the examples here, it is assumed that tink_await is also installed, but it is not a dependency of this library.
If needed, fetch the server's capabilities.
var caps: Capabilities = @await client.getCapabilities();
trace(caps.limits.max); // server supports fetching a maximum of this many results on each search
if (caps.searching.tvSearch.available)
{
// server supports search for tv shows
}
Then search for torrents using the search() method.
var result: SearchResult = @await client.search('the avengers');
for (torrent in result.items)
{
trace(torrent.magnetUrl);
}
Searches can be narrowed down with the second optional argument.
client.search('the avengers', {
searchType: Movie,
categories: [ 2045, 2050 ], // UHD and BluRay; obtained from the server's capabilities
limit: 10
});