Rarbg.to API
This is an unofficial nodejs api wrapper for rarbg.to website.
Installation
First download this package from npm registry
npm i --save rarbg-api
and require it from your project:
const rarbgApi =
Environment Flags
NODE_ENV
- Can be set to
debug
to see debug messages and errors
LOCAL_ADDRESS
- Can be set to a network interface ip address in order to send requests from that source
- See http.request.options for more details
API
.list([options: Object]): Array
List torrent.
Parameters
-
options
- Object
- Optional
Returns
The api returns a promise which will resolve a list of torrent.
.search(keyword[, options, type]): Array
Search torrent using a keyword.
Parameters
-
keyword
- String
Specify a keyword to search.
-
options
- Object
- Optional
-
type
- String
- Optional
Specify a search mode to use. Available type is:
['imdb', 'tvdb', 'themoviedb', 'tvrage']
. If search type is provided, the search keyword is a specific id, for example, if you provideimdb
search type, the keyword must be aimdb
id. Eg:search('tt0944947', null, 'imdb')
.
Returns
The api returns a promise which will resolve the search result.
Additional options
Some of the apis support category filtering and sorting, and other options. All available options are:
const defaultParams = category: null limit: 25 sort: 'last' min_seeders: null min_leechers: null format: 'json_extended' ranked: null
category
You can specify a category to filter the torrent. Category information can be imported by require('./index').CATEGORY
. This options support an array.
Eg:
const rarbgApi = rarbgApi
The above example will list latest movie torrents.
4K Support
const rarbgApi = rarbgApi
The above example will list latest 4K movie torrents.
limit
Limit the result torrent's size. Default size is 25, all supported options are: 25, 50, 100
Eg:
const rarbgApi = rarbgApi
sort
Specify the sorting. Default sorting is last
. Available options are: last, seeders, leechers
Eg:
const rarbgApi = rarbgApi
min_seeders, min_leechers
Filtering the torrent by specify the torrent's minimal seeders or minimal leechers. It's value is a number. Default is null
.
Eg:
const rarbgApi = rarbgApi
format
Specify which format will the api returns. Default is json_extended
, which will include the detail infomations of each torrent. Other supported option is json.
The json_extended
format is:
The json
format is:
ranked
By default the api will return only ranked torrents ( internal ) , scene releases -rarbg releases -rartv releases.
If you want other groups included in the results use the ranked parameter with a value of 0 to get them included.
Test
Clone this project, and install the dependencies npm i
, npm run build
and run npm run test
to see the test result.
Note that sometimes the test will fail because of the network problem. Currently all the tests timeout is 60000ms, if your network is poor, you may encounter test timeout error.
Limitation
Due to the rarbg api's limitation, you may encounter error like:
The api is limit to 1req/2sec, so you should control the frequency.