Skip to content

itzCozi/wyzie-lib

Repository files navigation

Wyzie Lib

Wyzie Lib is a package made for easily implementing Wyzie Subs into your project without all the fuss. Read our source code!

New VTT Parser!

Features

  • Fast: This package was written in Vite with TypeScript, so it's fast and reliable.
  • Simple: Just one function for searching subtitles using Wyzie Subs API.
  • VTT Parser: Convert SRT subtitles to VTT format quickly.
  • Open-Source: The API and package are open-source.

Installation

NPM

npm install wyzie-lib

PNPM

pnpm install wyzie-lib

Yarn

yarn add wyzie-lib

Usage

import { type SubtitleData, searchSubtitles, parseToVTT } from "wyzie-lib";

// Fetches all subtitles for the media with the TMDB ID 286217
const data: SubtitleData[] = await searchSubtitles({ tmdb_id: 286217, format: "srt" });
console.log(data[0].id); // Prints the ID of the first subtitle object

// Converts the first subtitle from SRT to VTT format
const vttContent = await parseToVTT(data[0].url); // Passes the first subtitle URL
console.log(vttContent); // Prints the raw VTT content

Check out demo.html for a working example using the VTT parser.

Parameters

Parameter Name Description
tmdb_id - number TmdbId The TMDB ID of the movie or TV show. (tmdb_id or imdb_id is required)
imdb_id - number ImdbId The IMDB ID of the movie or TV show. (imdb_id or tmdb_id is required)
format - string format The file format of the subtitles returned. (srt, ass, vtt, txt, sub, mpl, webvtt, dfxp)
season - number season Disired season of subtites (this requires episode parameter aswell)
episode - number episode The episode of the given season.
language - string language The ISO 3166 code of the provided subtitles.
hi - boolean isHearingImpaired A boolean indicating if the subtitles are hearing impaired.

Types

  • SearchSubtitlesParams: All valid parameters recognized by the API.
  • QueryParams: All parameters (optional and required) available for the wyzie-subs API.
  • SubtitleData: All returned values from the API with their respective types.

SearchSubtitlesParams QueryParams SubtitleData


Created by BadDeveloper with 💙