npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rarbg-api

v1.1.4

Published

A simple node.js wrapper for rarbg.to api

Downloads

48

Readme

Rarbg.to API

This is an unofficial nodejs api wrapper for rarbg.to website.

Build Status npm module dependencies

Installation

First download this package from npm registry

npm i --save rarbg-api

and require it from your project:

const rarbgApi = require('rarbg-api')

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

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

    See additional options section

  • 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 provide imdb search type, the keyword must be a imdb 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 = require('./index')

rarbgApi.list({
  category: rarbgApi.CATEGORY.MOVIES
}).then(data => console.log(data))

The above example will list latest movie torrents.

4K Support

const rarbgApi = require('./index')

rarbgApi.list({
  category: rarbgApi.CATEGORY['4K']
}).then(data => console.log(data))

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 = require('./index')

rarbgApi.list({
  limit: 50
}).then(data => console.log(data.length))

sort

Specify the sorting. Default sorting is last. Available options are: last, seeders, leechers

Eg:

const rarbgApi = require('./index')

rarbgApi.list({
  sort: 'seeders'
}).then(data => console.log(data))

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 = require('./index')
rarbgApi.list({
  min_seeders: 100
}).then(data => console.log(data))

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:

{ 
    "title": "Logan.2017.1080p.WEB-DL.DD5.1.H264-FGT",
    "category": "Movies/x264/1080",
    "download": "magnet:?xt=urn:btih:d2d6a72b60cdb2cc5e80d3277d89d5df18c3ecbc&dn=Logan.2017.1080p.WEB-DL.DD5.1.H264-FGT&tr=http%3A%2F%2Ftracker.trackerfix.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710&tr=udp%3A%2F%2F9.rarbg.to%3A2710&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce",
    "seeders": 848,
    "leechers": 116,
    "size": 5100226269,
    "pubdate": "2017-05-15 09:37:27 +0000",
    "episode_info": { 
        "imdb": "tt3315342",
        "tvrage": null,
        "tvdb": null,
        "themoviedb": "263115" 
    }
}

The json format is:

{
    "filename": "Real.Time.With.Bill.Maher.2017.06.09.1080p.WEB.h264-TBS[rartv]",
    "category": "TV HD Episodes",
    "download": "magnet:?xt=urn:btih:f6afb0028270ccca6d4535be4c42a0583a5a5737&dn=Real.Time.With.Bill.Maher.2017.06.09.1080p.WEB.h264-TBS%5Brartv%5D&tr=http%3A%2F%2Ftracker.trackerfix.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710&tr=udp%3A%2F%2F9.rarbg.to%3A2710&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce"
}

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:

{
  "error": "Too many requests per second. Maximum requests allowed are 1req/2sec Please try again later!",
  "error_code": 5
}

The api is limit to 1req/2sec, so you should control the frequency.