Installation
download the module
npm i rarbg-api-ts
include it in your project
// node wayconst rarbg = // es6 way
want to extend the api with your own functions? no problem, just import the "Rargb" class.
// node wayconst rarbg Rargb = // es6 way // code const myrarbg =
made with ♥️ and typescript
I added complete type support for all json api returns.
List
Get a list of torrents.
// (...params: Iparam[]): Promiserarbg
Search
Search for a torrent.
// (searchString: string, ...params: Iparam[]): Promiserarbg
Search Imdb
Search for a torrent using a Imdb Id
// (imdbId: string, ...params: Iparam[]): Promiserarbg
Search Tvdb
Search for a torrent using a Tvdb Id.
// (imdbId: string, ...params: Iparam[]): Promiserarbg
Parameters
Extend your search querys.
possible parameters are:
-
category
will restrict results to a certain category
Default is ALL
-
format
this defines what kind of results you get back
Default is SHORT
-
limit
this will limit or extend the ammount of results
Default is MEDIUM
-
min_leechers
this will restrict results to torrents that have a certain ammount of leechers
Default is "0"
-
min_seeders
this will restrict results to torrents that have a certain ammount of seeders
Default is "0"
-
ranked
this will decide if you only want to display scene torrents or not
Default is ONLY
-
sort
sort parameter will sort the results by seeders,leechers,last.
Default is LAST
Parameter Enums
For simplicity I created enums for every parameter value.
rarbgenums
Default Parameters
You can set default parameters that apply to every request.
rarbgdefaultcategory = rarbgenumsCATEGORYTV
Request Parameters
You can also set parameters for each Api request you do, by simply adding a json object with your wanted parameters to any Api function call like so (this will overwrite parameters set with rarbg.default
):
rarbg rarbg rarbg
Limits
The rargb api is limited to 1 request per 2 seconds per ip. Dont worry tho, rarbg-api-ts will automaticly keep you within this limit.
It will also automaticly request api tokens for you and replace them once they expire.