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

hanime

v1.2.1

Published

API for accessing hanime.tv

Downloads

40

Readme

HAnime API

A NodeJS module written in TypeScript to access hanime's undocumented API.

Usage

const { HAnimeAPI } = require('hanime');
const api = new HAnimeAPI();

const results = await api.search('query');

const video = await api.get_video(results.videos[0]);

Documentation

class HAnimeAPI: main API class

constructor(options?)

  • options (optional):
    • options.fetch_options: options to pass to node-fetch
    • options.timeout: timeout, in ms, for fetch requests

async search(query: string, config?: SearchConfig): Promise<HAnimeSearch>: preforms a search

  • query: query to search for
  • config (optional): search config
    • config.tags: string[]: tags to search for
    • config.tags_mode: 'AND' | 'OR': search for videos that have every tag provided, or at least one tag provided
    • config.brands: string[]: video publishers to search for
    • blacklist: string[]: tags to exclude
    • order_by: string: search ordering, one of 'created_at_unix', 'views', 'likes', 'released_at_unix', 'title_sortable'
    • ordering: 'desc' | 'asc': ordering for order_by
    • page: number: page to search on (0-indexed)
    • auto_tag: boolean: whether to convert search queries to tags. Example: query 'futa trap title' turns into tags ['futanari', 'trap'] and query 'title'. Default: true

async search(config: SearchConfig): Promise<HAnimeSearch>: preforms a search

  • config: search config
    • config.search_text: string: text to search for
    • config.tags: string[]: tags to search for
    • config.tags_mode: 'AND' | 'OR': search for videos that have every tag provided, or at least one tag provided
    • config.brands: string[]: video publishers to search for
    • blacklist: string[]: tags to exclude
    • order_by: string: search ordering, one of 'created_at_unix', 'views', 'likes', 'released_at_unix', 'title_sortable'
    • ordering: 'desc' | 'asc': ordering for order_by
    • page: number: page to search on (0-indexed)

async get_video(video: APIShortVideoInfo | string): Promise<HAnimeVideo>: gets full video info given a short info from a search query, or a slug

class HAnimeSearch: results from a search

page: number: the current page of this search

pages: number: the total number of pages for this search

hits_per_page: number: the number of videos in a page

hits: number: the total number of videos for this search

videos: APIShortVideoInfo[]: a list of short video info objects

class HAnimeVideo: video info

titles: APITitle[]: the different titles for this video in different languages

name: string: the name of this video

views: number: the number of views this video has

interests: number: the number of interests this video has

poster_url: string: the url for the vertical poster of this video

cover_url: string: the url for the horizontal cover preview of this video

video_url: string: the url for the actual video

duration: number: the duration of this video, in ms. May be 0

brand: gets the animator of the video. Has the following properties:

  • count: number: number of videos this brand has on the site
  • email: string: email, may be null
  • id: number: internal id of this brand
  • logo_url: string: logo, may be null
  • slug: string: internal slug
  • title: string: name of brand
  • website_url: string: website, may be null

rating: number: rating of the video

likes: number: number of likes

dislikes: number: number of dislikes

downloads: number: number of downloads

monthly_rank: number: monthly rank of this video

created_at: Date: date this video was created

released_at: Date: date this video was released

description: string: plaintext description of the video

tags: array of tags. Each element has the following properties:

  • id: number: internal id of this tag
  • text: string: the tag
  • count: number: ?
  • description: string: "witty" description of this tag

franchise: which franchise this video is from. Has the following properties

  • id: number
  • name: string
  • slug: string
  • title: string

franchise_videos: APIFranchiseVideoInfo[]: other videos in thie franchise

next_video: APIFranchiseVideoInfo: next-up video

next_random_video: APIFranchiseVideoInfo: random video

data: raw data returned by API

Types

APITitle

type APITitle = {
    lang: string, // en, x-jat (romanji), ja, ko
    kind: string, // main, official, syn
    title: string
}

APIFranchiseVideoInfo

type APIFranchiseVideoInfo = {
    brand: string,
    brand_id: string,
    cover_url: string,
    created_at: string,
    created_at_unix: number,
    dislikes: number,
    downloads: number,
    duration_in_ms: number | 0,
    id: string,
    interests: number,
    is_banned_in: string,
    is_censored: boolean,
    is_hard_subtitled: boolean,
    likes: number,
    monthly_rank: number,
    name: string,
    poster_url: string,
    preview_url: null, // TODO: what is this supposed to be?
    primary_color: null, // TODO: what is this supposed to be?
    rating: number | null,
    released_at: string,
    released_at_unix: number,
    slug: string,
    views: number
}

APIShortVideoInfo

export type APIShortVideoInfo = {
    brand: string,
    brand_id: number,
    cover_url: string,
    created_at: number,
    description: string,
    dislikes: number,
    downloads: number,
    duration_in_ms: number | 0,
    id: number,
    interests: number,
    is_censored: boolean,
    likes: number,
    monthly_rank: number,
    name: string,
    poster_url: string,
    rating: number,
    released_at: number,
    slug: string,
    tags: APITags[],
    titles: string[],
    views: number
};

APITags

export const APITags = [
    '3d',
    'ahegao',
    'anal',
    'bdsm',
    'big boobs',
    'blow job',
    'bondage',
    'boob job',
    'censored',
    'comedy',
    'cosplay',
    'creampie',
    'dark skin',
    'facial',
    'fantasy',
    'filmed',
    'foot job',
    'futanari',
    'gangbang',
    'glasses',
    'hand job',
    'harem',
    'hd',
    'horror',
    'incest',
    'inflation',
    'lactation',
    'loli',
    'maid',
    'masturbation',
    'milf',
    'mind break',
    'mind control',
    'monster',
    'nekomimi',
    'ntr',
    'nurse',
    'orgy',
    'plot',
    'pov',
    'pregnant',
    'public sex',
    'rape',
    'reverse rape',
    'rimjob',
    'scat',
    'school girl',
    'shota',
    'softcore',
    'swimsuit',
    'teacher',
    'tentacle',
    'threesome',
    'toys',
    'trap',
    'tsundere',
    'ugly bastard',
    'uncensored',
    'vanilla',
    'virgin',
    'watersports',
    'x-ray',
    'yaoi',
    'yuri'
] as const;

export type APITags = (typeof APITags)[number];