Skip to content

Nyaa.pantsu.cat

Kylart edited this page Oct 21, 2017 · 8 revisions

Disclaimer

Please check out the official nyaa.pantsu.cat's api documentation for all the available options for each methods.

All the results given by nyaapi are as described in the corresponding method on the nyaa pantsu's api.

If you find any encounter problem, do no hesitate to post an issue in the issue section.

Available methods

Import

const {pantsu} = require('nyaapi')

[Pantsu] methods:

search

prototype

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

The opts parameter accepts every parameter just as the docs says.

Usage

There are two ways of using this method.

  • 3 arguments
pantsu.search('HorribleSubs', 20, {
  order: true,
  sort: '4'
})
  .then((data) => console.log(data))
  .catch((err) => console.log(err))
  • 1 object argument
pantsu.search({
  term: 'HorribleSubs',
  n: 20,
  order: true,
  sort: '4'
})
  .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

pantsu.searchAll(term, opts = {})

The opts parameter accepts every parameter just as the docs says.

Usage

There are two ways of using this method.

  • 2 arguments
pantsu.searchAll('HorribleSubs', {
  order: true,
  sort: '4'
})
  .then((data) => console.log(data))
  .catch((err) => console.log(err))
  • 1 object argument
pantsu.searchAll({
  term: 'HorribleSubs',
  order: true,
  sort: '4'
})
  .then((data) => console.log(data))
  .catch((err) => console.log(err))

infoRequest

prototype

pantsu.infoRequest(id)

Usage

pantsu.infoRequest(537126)
  .then((data) => console.log(data))
  .catch((err) => console.log(err))

checkUser

prototype

pantsu.checkUser(id)

Usage

pantsu.checkUser(12035)
  .then((data) => console.log(data))
  .catch((err) => console.log(err))

checkHeader

prototype

pantsu.checkHeader(id)

Usage

pantsu.checkHeader(my_id)
  .then((data) => console.log(data))
  .catch((err) => console.log(err))

login

prototype

pantsu.login(credentials)

Usage

pantsu.login({
  username: 'my_super_username',
  password: 'my_super_secret_password'
})
  .then((data) => console.log(data))
  .catch((err) => console.log(err))

upload

prototype

pantsu.upload(opts)

The opts parameter accepts every parameter just as the docs says.

Usage

There are two ways of using this method.

pantsu.upload({
  token: 'my_token',
  username: 'my_super_username',
  magnet: '<magnet_hash>',  # Only if you want to upload via a magnet!
  torrent: '<absolute_path_to_file>',  # Only if you want to upload a torrent file!
})
  .then((data) => console.log(data))
  .catch((err) => console.log(err))

update

prototype

pantsu.update(opts)

The opts parameter accepts every parameter just as the docs says.

Usage

There are two ways of using this method.

pantsu.update({
  token: 'my_token',
  username: 'my_super_username',
  id: '<Torrent ID>',
  name: 'A new name',
  ...otherOptions...
})
  .then((data) => console.log(data))
  .catch((err) => console.log(err))