0.6.0 • Published 12 months ago

ncore-api v0.6.0

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

ncore-api

What

It provides REST API for ncore torrent provider.

Why

As the time of the writing, ncore has no REST API at all. With the help of this package, a lot of new possibilities could be risen in terms of ncore related applications: torrent notifier, native applications ... etc.

How it works

It transforms html content to JSON output.

How it should be used

const createNcoreApi = require('ncore-api');

(async () => {
  try {
    const ncoreApi = await createNcoreApi({
      username: '', // needs to be filled
      password: '', // needs to be filled
    });
    const result = await ncoreApi.getMovies();
    console.log(result);
  } catch (error) {
    console.log(error);
  }
})();

API

getMovies

The result contains the first 25 item from movie section according to the given filters.

Parameter

It accepts only one parameter which is a filter object.

PropertyDefaultDescription
genres[]List of genres. Possible values: animáció, vígjáték, misztikus, ismeretterjesztő, dráma, thriller, háborús, valóságshow, életrajz, családi, western, akció, bűnügyi, horror, fantasy, romantikus, rövidfilm, történelmi, dokumentumfilm, musical, sport, kaland, sci-fi, zene
sortByuploadedSorting criteria. Possible values: title,uploaded,size,downloaded_times,seeders,leechers
sortDirectionDESCThe direction of the sorting. DESC orASC

Return value

It returns an array with objects. This is how a movie object looks like:

PropertyTypeDescription
idstringThe id of the torrent
imdbIdstringThe IMDB id of the movie
imdbUrlstringThe IMDB url of the movie
titlestringThe title of the torrent
last_modifiedstringThe datetime when the torrent was modified at the last time

getMovie

This returns the details of the given movie (with languages and resolutions)

Parameter

It accepts only one parameter which is a torrent id.

ParameterTypeDescription
idstringThe id of the torrent

Return value

It returns an objects with this schema:

PropertyTypeDescription
idstringThe id of the torrent
imdbIdstringThe IMDB id of the movie
imdbUrlstringThe IMDB url of the movie
titlestringThe title of the torrent
languagestringThe language of the audio
sizenumberThe downloaded size of the movie
qualitystringThe resolution of the given version
downloadUrlstringThe url where the torrent file of the movie could download
versionsarrayThe other versions of the movie

Versions contains objects that look like this:

PropertyTypeDescription
torrentIdstringThe id of the torrent
titlestringThe title of the torrent
sizenumberThe downloaded size of the movie
qualitystringThe resolution of the given version
languagestringThe language of the audio
downloadUrlstringThe url where the torrent file of the movie could download

getMovieByImdb

This returns the details of the movie that was searched by IMDB id.

Parameter

It accepts only one parameter which is a IMDB id.

ParameterTypeDescription
imdbIdstringThe IMDB id of the given movie

Return value

It returns an objects with this schema:

PropertyTypeDescription
idstringThe id of the torrent
imdbIdstringThe IMDB id of the movie
imdbUrlstringThe IMDB url of the movie
titlestringThe title of the torrent
last_modifiedstringThe datetime when the torrent was modified at the last time
sizenumberThe downloaded size of the movie
languagestringThe language of the audio
qualitystringThe resolution of the given version
versionsarrayThe other versions of the movie

Versions contains objects that look like this:

PropertyTypeDescription
idstringThe id of the torrent
imdbIdstringThe IMDB id of the movie
imdbUrlstringThe IMDB url of the movie
titlestringThe title of the torrent
last_modifiedstringThe datetime when the torrent was modified at the last time
sizenumberThe downloaded size of the movie
languagestringThe language of the audio
qualitystringThe resolution of the given version

getTorrentFile

It returns a node.js stream that contains a torrent file.

Parameter

It accepts only one parameter which is a torrent id.

ParameterTypeDescription
idstringThe id of the torrent

Return value

Example:

const createNcoreApi = require('ncore-api');
const { createWriteStream } = require('fs');

(async () => {
  try {
    const ncoreApi = await createNcoreApi({
      username: '*******',
      password: '*******',
      url: 'https://ncore.pro',
    });
    const result = await ncoreApi.getTorrentFile('2949391');
    result.pipe(createWriteStream('torrent.file'));
  } catch (error) {
    console.log(error);
  }
})();

Missing features

  • pagination
  • tv shows related endpoints