npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

horriblesubs-node

v0.2.3

Published

Non official Horriblesubs Node package

Downloads

25

Readme

HorribleSubs Node

Non official Horriblesubs Node package

Why ?

I want to build an app that could download automatically the current shows of the season when they're updated. Sadly the main site where the links of HBS are hosted doesn't have a good searcher and it has a lot of entries of the same anime which makes things harder to find. For that reason, I decided to scrap the HBS page because most of their responses are structured in some way, it has a lot less entries and they're my main source of anime for the season lol.

Consideration

Some strings needs an specific format to make work correctly some functions, those will be pointing out bellow with the ** tag, I think it should be easy for you to format them before using the functions :).

Usage

searchAnime(searchedAnime: string**, { page, combinePages, interval }) => Anime[]

  • The searchedAnime string should be formatted with + between each words, like Sword+art+online.
  • The elements in the response will be ordered by chapter in descending order.
  • Example. The order of the items are in descending order from most recenlty to oldest.
  searchedAnime('Sword+art+online', { pages: 2, combinePages: true })
  
  Result:
  [
    {
      title: 'Sword Art Online - Alicization - War of Underworld - 12',
      releaseDate: '12/28/19',
      resolutions: 'SD - 720p - 1080p',
      url:
       'https://horriblesubs.info/shows/sword-art-online-alicization-war-of-underworld#12',
      slug: 'sword-art-online-alicization-war-of-underworld'
    },
    ...
  ]

getAnimeID(animeSlug: string**) => string

  • The animeSlug, as the name suggest, accepts an string formatted with - between each words, like ero-manga-sensei.
  • Example
  getAnimeID('boku-no-hero-academia')
  
  Result:
  659

getEpisodes({ slug?**: string, id?: string | number }, animeID: string | number, { page, combinePages, interval }) => Episode[]

  • You can send an animeSlug or an animeID, and, if you send an ID then the request to HBS to get it will be skipped, keep that in mind.
  • The animeSlug, as the name suggest, accepts an string formatted with - between each words, like black-clover.
  • The elements in the response will be ordered by chapter in descending order.
  • Example
  getEpisode({ slug: 'black-clover' }, { page: 1 })
  
  Result:
  [
    {
      chapter: { title: ' Black Clover 104', releaseDate: '10/08/19' },
      resolutions: [
        { 
          resolution: '480p',
          sources: {
            Magnet: 'magnet?',
            Torrent: '',
            XDCC: '',
            'Uploaded.net': '',
            DropAPK: '',
            Rockfile: ''
          }
        },
        { 
          resolution: '720p',
          sources: {
            Magnet: 'magnet?',
            Torrent: '',
            XDCC: '',
            'Uploaded.net': '',
            DropAPK: '',
            Rockfile: ''
          }
        },
        { 
          resolution: '1080p',
          sources: {
            Magnet: 'magnet?',
            Torrent: '',
            XDCC: '',
            'Uploaded.net': '',
            DropAPK: '',
            Rockfile: ''
          }
        }
      ]
    },
    ...
  ]

getShows({ currentSeason: boolean = false }) => Show[]

  • If currentSeason is false, then the list of all available shows in HBS will be retrieved.
  • If currentSeason is true, then only the show curretly airing will be retrieved.
  • Example
  getShows({ currentSeason: true });

  Result:
  [ 
    {
      title: 'Ace of Diamond Act II',
      url: 'https://horriblesubs.info/shows/ace-of-diamond-act-ii' },
    },
    ...
  ]

Options

This only applys to the searchAnime and getEpisodes functions. That is because those functions need a way to give control to the user over the pagination implemented in the HBS request.

{ page: number, combinePages: boolean, interval: number }

  • page If declared alone, this option lets you request any page from the given show. The default value is 0.
  • combinePages When it's declared as true, it will let you request the pages from [0 to page] and it will return all of them combined into a single array. By default is false.
  • interval It let you modified the interval between each request made to HBS, this options takes precenden over the environment variable.

Environment Variables

You can modify some of the values declared in the package by declaring the following environment variables

HBS_INTERVAL

Interval between each request to HBS, this will override the default value of 500ms

HBS_BASE_URL

The base url of HBS, this will override the default value of https://horriblesubs.info

HBS_DEBUG

This will activate the debug mode and it will print the whole error message the could happen in any of the function of the package.