UNPKG

@spacepumpkin/proxified-nyaapi

Version:

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

30 lines (26 loc) 655 B
const { initialize, makeProxyRequest } = require('@spacepumpkin/flux-proxify') const BASE_URL = 'https://nyaa.si' module.exports = { init, url: BASE_URL, cli: { get }, /** * Allows to specify a specific URL to access nyaa * * @param {String} url New URL to use * @returns {void} */ updateBaseUrl(url) { this.url = url } } async function get(url, opts) { const params = opts.params ? '?' + new URLSearchParams(opts.params).toString() : '' const res = await makeProxyRequest(`${BASE_URL}${url}${params}`) return { data: res.body } } function init(gateway) { initialize(gateway) }