-
Notifications
You must be signed in to change notification settings - Fork 17
Nyaa.si
Kylart edited this page Oct 22, 2017
·
12 revisions
If you find any encounter problem, do no hesitate to post an issue in the issue section.
const {si} = require('nyaapi')
[si] methods:
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.
}
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
.
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.
}
There are two ways of using this method.
- 2 arguments
si.searchAll('HorribleSubs', {
filter: 2,
})
.then((data) => console.log(data))
.catch((err) => console.log(err))
- 1 object argument
si.searchAll({
term: 'HorribleSubs',
filter: 2,
})
.then((data) => console.log(data))
.catch((err) => console.log(err))
si.searchPage(term, p, 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.
}
There are two ways of using this method.
- 3 arguments
si.searchPage('HorribleSubs', 3, {
filter: 2,
})
.then((data) => console.log(data))
.catch((err) => console.log(err))
- 1 object argument
si.searchPage({
term: 'HorribleSubs',
p: 2,
filter: 2,
})
.then((data) => console.log(data))
.catch((err) => console.log(err))
si.searchByUser(user, 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.
}
There are two ways of using this method.
- 4 arguments
si.searchByUser('HorribleSubs', 'Youjo Senki', 20, {
filter: 2,
})
.then((data) => console.log(data))
.catch((err) => console.log(err))
- 1 object argument
si.searchByUser({
user: 'HorribleSubs',
term: 'Youjo Senki',
n: 20,
filter: 2,
})
.then((data) => console.log(data))
.catch((err) => console.log(err))
If no n
parameter is given, nyaapi will call the searchAllByUser
method with the same parameters.
si.searchAllByUser(user, 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.
}
There are two ways of using this method.
- 3 arguments
si.searchAllByUser('HorribleSubs', 'Youjo Senki', {
filter: 2,
})
.then((data) => console.log(data))
.catch((err) => console.log(err))
- 1 object argument
si.searchAllByUser({
user: 'HorribleSubs',
term: 'Youjo Senki',
filter: 2,
})
.then((data) => console.log(data))
.catch((err) => console.log(err))
si.searchByUserAndByPage(user, term = '', p = null, 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.
}
There are two ways of using this method.
- 5 arguments
si.searchByUserAndByPage('HorribleSubs', '720p', 3, 45, {
filter: 2,
})
.then((data) => console.log(data))
.catch((err) => console.log(err))
- 1 object argument
si.searchByUserAndByPage({
user: 'HorribleSubs',
term: '720p',
p: 3, # Page number
n: 45,
filter: 2,
})
.then((data) => console.log(data))
.catch((err) => console.log(err))
si.upload(opts)
opts
may contain one of those:
opts = {
// All the following are required!
credentials: {
username: 'my_super_username',
password: 'my_super_secret_password'
},
torrent: '<absolute path to the torrent file to upload>',
category: '1_1', # The category of the file you are uploading
// The following are optionals!
name: 'Hello.mkv.torrent', # The name of the file you are uploading
information: 'my_website.com',
description: 'This is the best torrent ever. Download it!',
anonymous: true, # boolean
hidden: false, # boolean
complete: true, # boolean
remake: false, # boolean
trusted: true # boolean
}
si.upload({
credentials: {
username: 'my_super_username',
password: 'my_super_secret_password'
},
torrent: '/path/to/my/torrent/file.torrent',
name: 'Hello.mkv.torrent',
category: '1_2',
description: 'A movie saying "Hello" to everyone',
information: 'my_website.com',
complete: true
})
.then((data) => console.log(data))
.catch((err) => console.log(err))