Skip to content

Nyaa.si

Kylart edited this page Oct 22, 2017 · 12 revisions

Currently writing this page

Available methods

Import

const {si} = require('nyaapi')

[si] methods:

search

prototype

si.search(term, n = null, opts = {})

opts may contain one of those:

opts = {
  filter: 2,  # Represents the filter you want to apply to your research.
  category: '1_1'  # Represents the category you are looking for in your research.
}

Usage

There are two ways of using this method.

  • 3 arguments
si.search('HorribleSubs', 20, {
  filter: 2,
})
  .then((data) => console.log(data))
  .catch((err) => console.log(err))
  • 1 object argument
si.search({
  term: 'HorribleSubs',
  n: 20,
  filter: 2,
})
  .then((data) => console.log(data))
  .catch((err) => console.log(err))

If no n parameter is given, nyaapi will call the searchAll method with the same term and options.

searchAll

prototype

si.searchAll(term, opts = {})

opts may contain one of those:

opts = {
  filter: 2,  # Represents the filter you want to apply to your research.
  category: '1_1'  # Represents the category you are looking for in your research.
}

Usage

There are two ways of using this method.

  • 2 arguments
si.search('HorribleSubs', {
  filter: 2,
})
  .then((data) => console.log(data))
  .catch((err) => console.log(err))
  • 1 object argument
si.search({
  term: 'HorribleSubs',
  filter: 2,
})
  .then((data) => console.log(data))
  .catch((err) => console.log(err))
Clone this wiki locally