whvx-subs
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

WHVX Subs

A lightweight, easy-to-use Node.js package for fetching movie and TV show subtitles from the WHVX Subs API. Supports multiple subtitle formats and languages, with IMDb and TMDb integration.

More Info At: https://subs.whvx.net

Features

  • Fetch subtitles for movies and TV shows using IMDb or TMDb IDs.
  • Supports both CommonJS and ES Module.
  • Easy integration with your Node.js projects.

Installation

Install the package using npm:

npm install whvx-subs

Usage

You can use this package in both CommonJS and ES Module environments.

CommonJS

const whvxSubs = require('whvx-subs');

async function fetchSubtitles() {
  try {
    const subtitles = await whvxSubs.searchSubtitles('tt1234567', 1, 1);
    console.log(subtitles);
  } catch (error) {
    console.error('Error fetching subtitles:', error);
  }
}

fetchSubtitles();

ES Module

import { searchSubtitles } from 'whvx-subs';

async function fetchSubtitles() {
  try {
    const subtitles = await searchSubtitles('tt1234567', 1, 1);
    console.log(subtitles);
  } catch (error) {
    console.error('Error fetching subtitles:', error);
  }
}

fetchSubtitles();

API

searchSubtitles(id: string, season?: number, episode?: number): Promise<SubtitleResponse>

Fetches subtitles based on the provided ID. The season and episode parameters are optional and should be used for TV shows.

  • id: The IMDb or TMDb ID for the movie or TV show.
  • season (optional): The season number (required for TV shows).
  • episode (optional): The episode number (required for TV shows).

Example:

const subtitles = await searchSubtitles('tt1234567');

Package Sidebar

Install

npm i whvx-subs

Weekly Downloads

7

Version

1.0.2

License

MIT

Unpacked Size

5.47 kB

Total Files

7

Last publish

Collaborators

  • wafflehacker