Skip to content

Latest commit

 

History

History
98 lines (81 loc) · 2.69 KB

README.md

File metadata and controls

98 lines (81 loc) · 2.69 KB

horriblesubs-api

Build Status Coverage Status Dependency Status devDependency Status

An HorribleSubs API wrapper to get data from horriblesubs.info.

Usage

Setup

npm install --save horriblesubs-api

Initialize

const HorribleSubsApi = require('horriblesubs-api')

// Create a new instance of the module.
const horriblesubs = new HorribleSubsApi({
  baseUrl, // The base url of horriblesubs. Defaults to 'https://horriblesubs.info/'.
  debug // Show extra output. Defaults to 'false'.
})

Example usage

// Get all available shows on horriblesubs.
horriblesubs.getAllAnime().then(res => {
  const [ data ] = res
  console.log(data)

  // Get data including episodes from horriblesubs.
  return horriblesubs.getAnimeData(data)
}).then(res => console.log(res))
  .catch(err => console.error(err))

Output

getAllAnime

[{
  link: '/shows/91-days',
  slug: '91-days',
  title: '91 Days'
}, {
  link: '/shows/absolute-duo',
  slug: 'absolute-duo',
  title: 'Absolute Duo'
}, ...]

getAnimeData

{ link: '/shows/91-days',
  slug: 'ninety-one-days',
  title: '91 Days',
  hs_showid: '731',
  episodes:
   { '1':
      { '1':
        { '480':
          { url: 'magnet:?xt=urn:btih:AYIJKPLP5WVVF36O25JBB3FFPNJEBBPQ&tr=http://open.nyaatorrents.info:6544/announce&tr=udp://tracker.openbittorrent.com:80/announce&tr=udp://tracker.coppersurfer.tk:6969/announce',
          seeds: 0,
          peers: 0,
          provider: 'HorribleSubs' } },
        ...
      }
    }
}

Nested within the episodes property there is the season number within the season number is the episode number and within the episode number are the different qualities of the torrent.

Testing

You can run tests with the following npm command:

 $ npm test

License

MIT License