# Dev notes ## Resources - - - - for testing: --- example usage: ```rust let config = /* config goes here */ fn main() -> Result { run(config); } ``` ## Torznab spec ### Query results Queries are returned as an RSS feed something like this: ```rss Prowlarr Item title http://localhost:9999/ ``` Item attributes: - RSS: - `title`: title of the thing; can maybe be empty? unsure - torznab-toolkit will treat this as required, and set description to be empty - `description`: description; can just be empty - `link`: a link - Preferably specified, if not then fallback to .torrent link, then magnet url - at least title *or* description is required; link is recommended for compatibility with some non-compliant software, like headphones (see [bitmagnet issue 349](https://github.com/bitmagnet-io/bitmagnet/issues/349)) - Torznab - Required: - `size`: Size in bytes - `category`: (Sub)category id; can occur multiple times for several categories - Recommended (by me, based off my own thoughts and NZBDrone's [Implementing a Torznab indexer](https://nzbdrone.readthedocs.io/Implementing-a-Torznab-indexer/) page): - `seeders`: Number of seeders - `leechers`: Number of leechers - `peers`: Number of peers - `infohash`: Torrent infohash - `magneturl`: The magnet URI for the torrent - URLs: - Main URI can either be a magnet URI or a link to a .torrent file: `` - Length is ambiguous, so it will just be 0 (see below) - for magnet: `application/x-bittorrent;x-scheme-handler/magnet` - If .torrent URL is provided, use that, if not use the magnet; also put the magnet in `magneturl` - Rest of available attributes: --- ## Non-compliance and errors in the Torznab spec - Prowlarr's built-in indexer for sites it scrapes (like 1337x) does not respect `limit` - Negative `limit`: The spec says that if `limit` is negative, then to return `201 - Incorrect parameter`; but 201 is Created, and there's no Incorrect Parameter HTTP status code (my best guess is it should be 400?). Additionally, other indexers just ignore the limit if it's negative, so in that case, torznab-toolkit will just set the limit to the maximum to match the behavior of other widely-used indexers. ## Ambiguous behavior - Due to ambiguous behavior, torznab-toolkit will set `length` to 0 > The correct definition of the enclosure length attribute should have been the size of the .torrent file, however newznab defined it as the length of the usenet download rather than the .nzb size. > Therefore the length attribute can be either 0, or the .torrent/.nzb file size, or the actual media size. Given this ambiguity, services should instead provide the size extended attribute with the size of the media. (eg. ) (from [Torznab spec - Torznab Torrent Support](https://torznab.github.io/spec-1.3-draft/revisions/1.0-Torznab-Torrent-Support.html]))