UNPKG

@spacepumpkin/modified-nyaapi

Version:

Non-official api for getting torrent links from Nyaa.si and Nyaa.pantsu.cat

31 lines (25 loc) 669 B
const request = require('request-promise') const URI = require('./url.json').url /** * Allows to check a user profile from its ID. * * @param {number|string} id The ID of the user you want to check the profile. * * @returns {promise} */ const checkUser = (id) => { return new Promise((resolve, reject) => { if (!id) { reject(new Error('[Nyaapi]: No ID was given on user check demand.')) return } request.get(URI + 'profile', { qs: { id } }) .then((data) => resolve(JSON.parse(data))) .catch(/* istanbul ignore next */ (err) => reject(err)) }) } module.exports = { checkUser }