whvx-subs
v1.0.2
Published
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.
Downloads
12
Maintainers
Readme
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');