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 🙏

© 2026 – Pkg Stats / Ryan Hefner

subdl

v1.0.0

Published

A TypeScript library designed to fetch and download subtitles for movies from various subtitle websites.

Downloads

11

Readme

SubDL - Subtitle Downloader Library

SubDL is a TypeScript library designed to fetch and download subtitles for movies from various subtitle websites. It supports multiple subtitle sources and provides a unified interface to search and download subtitles.

[!NOTE] There is also a go version of this library available at subdl_go

Features

  • Fetch subtitles from multiple sources:
    • OpenSubtitles.com
    • MovieSubtitles.org
    • MovieSubtitlesRT.com
    • Podnapisi.net
    • SubDL.com
    • YifySubtitles.ch
  • Filter subtitles by language
  • Downloads subtitles and handles ZIP files automatically

Installation

TODO: Publish to NPM

Usage

Importing the Library

First, import the necessary functions and types from the library:

import { SubtitleOptions, MovieList, DownloadedFile, Fetcher, Download, ErrNoMovies, ErrNoSubtitles } from 'subdl';
import { FetchOpenSubtitlesCom, FetchMovieSubtitlesOrg, FetchMoviesubtitlesrtCom, FetchPodnapisiNet, FetchSubdlCom, FetchYifySubtitlesCh } from 'subdl';

Using the Unified Download Function

To fetch subtitles for a movie, you can use one of the fetch functions provided by the library. Each Fetch function corresponds to a different subtitle source.

async function downloadSubtitles() {
  const options: SubtitleOptions = { language: 'en' };
  const downloadOptions = {
    movieListQuery: 'The Matrix',
    movieListSorter: {},
    subtitleListQuery: '',
    subtitleListSorter: {},
  };

  try {
    // Download subtitles from OpenSubtitles.com
    const fileOpenSubtitles = await Download('The Matrix', options, FetchOpenSubtitlesCom, downloadOptions);
    console.log(fileOpenSubtitles.filename + ':', fileOpenSubtitles.subtitles[0].slice(0, 100));

    // Download subtitles from MovieSubtitles.org
    const fileMovieSubtitlesOrg = await Download('The Matrix', options, FetchMovieSubtitlesOrg, downloadOptions);
    console.log(fileMovieSubtitlesOrg.filename + ':', fileMovieSubtitlesOrg.subtitles[0].slice(0, 100));

    // Download subtitles from MovieSubtitlesRT.com
    const fileMovieSubtitlesRT = await Download('The Matrix', options, FetchMoviesubtitlesrtCom, downloadOptions);
    console.log(fileMovieSubtitlesRT.filename + ':', fileMovieSubtitlesRT.subtitles[0].slice(0, 100));

    // Download subtitles from Podnapisi.net
    const filePodnapisiNet = await Download('The Matrix', options, FetchPodnapisiNet, downloadOptions);
    console.log(filePodnapisiNet.filename + ':', filePodnapisiNet.subtitles[0].slice(0, 100));

    // Download subtitles from SubDL.com
    const fileSubdlCom = await Download('The Matrix', options, FetchSubdlCom, downloadOptions);
    console.log(fileSubdlCom.filename + ':', fileSubdlCom.subtitles[0].slice(0, 100));

    // Download subtitles from YifySubtitles.ch
    const fileYifySubtitlesCh = await Download('The Matrix', options, FetchYifySubtitlesCh, downloadOptions);
    console.log(fileYifySubtitlesCh.filename + ':', fileYifySubtitlesCh.subtitles[0].slice(0, 100));
  } catch (error) {
    if (error === ErrNoMovies) {
      console.error('No movies found');
    } else if (error === ErrNoSubtitles) {
      console.error('No subtitles found');
    } else {
      console.error('An error occurred:', error);
    }
  }
}

Using Fetch functions directly

You can use fetch functions directly to have more control over how the subtitles are downloaded.

each Fetch function returns a MovieList array, which contains a list of movies that match the search query. You can then use the toSubtitleLinks method on any movie in list to get it's subtitle list. MovieList.toSubtitleLinks() returns a SubtitleList array, which has download method to download the subtitle.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue if you encounter any problems or have suggestions for improvements.

License

This project is licensed under the MIT License. See the LICENSE file for details.