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

youtube-subtitles-downloader

v1.0.2

Published

Youtube subtitles scraper library and CLI

Downloads

11

Readme

Youtube Subtitles Downloader

dependencies Status devDependencies Status

Node library for download subtitles from Youtube and translate them or convert to SRT. Also available as CLI. Partially used with the Youtube Subtitles Viewer Chrome extension

Install

npm install youtube-subtitles-downloader

install global for use the CLI

npm install -g youtube-subtitles-downloader

Usage example

const id = YTSubtitles.extractIdFromUrl('https://www.youtube.com/watch?v=vG-QZOTc5_Q')

YTSubtitles.getLanguagesList(id).then((resp) => {
  resp[0].fetch().then(lang => {
    console.log(lang)
    // do something else with subtitles
  })
})

using the CLI

$ ytsub uICEJnBuhy0 -l en
$ ytsub uICEJnBuhy0 -s
$ ytsub uICEJnBuhy0 -l en -s -o sub.srt
$ ytsub uICEJnBuhy0 -t el
$ ytsub list uICEJnBuhy0
$ ytsub list-translations uICEJnBuhy0

YTSubtitles

async YTSubtitles.getSubtitles(videoID, languageCode)

Download the subtitles of the video using the optional language code

Params
  • videoID: YouTube video ID
  • languageCode (optional): language code of the subtitles to return
Return

Array with the fetched subtitles content

async YTSubtitles.getLanguagesList(videoID)

Get the languages list for the video

Params
  • videoID: YouTube video ID
Return

An array of subtitles objects (YTSub)

YTSubtitles.extractIdFromUrl(url)

Extract the video ID

Params
  • url: YouTube video URL
Return

String video ID

YTSub

async fetch()

Download the subtitles of the video

Return

Array with the fetched subtitles content

async fetchSRT()

Download the subtitles of the video in SRT format

Return

Array with the fetched subtitles content in SRT format

async translate(languageCode)

Translate the subtitle into another language returning a new YTSub object

Params
  • languageCode: Language code for translation
Return

A new YTSub object constructed with the new language

Properties

translationLanguages

List of languages object available for translate the subtitles

languageCode, languageName, languageId

Code, name and vvsId of the subtitles retrieved from YouTube

isTranslatable

Is current language is translatable

CLI

Usage: ytsub [options] [command] <video-id>

Download YouTube video subtitles using the video id

Options:
  -V, --version                    output the version number
  -l, --language <language-code>   Set subtitles language
  -t, --translate <language-code>  Translate subtitles in another language
  -s, --srt                        Output in SRT format
  -o, --output <path>              Output file
  -h, --help                       display help for command

Commands:
  list <video-id>                  Get the list of available languages with codes and names
  list-translations <video-id>     Get the list of available languages for translation

Examples:
  $ ytsub uICEJnBuhy0 -l en
  $ ytsub uICEJnBuhy0 -s
  $ ytsub uICEJnBuhy0 -l en -s -o sub.srt
  $ ytsub uICEJnBuhy0 -t el
  $ ytsub list uICEJnBuhy0
  $ ytsub list-translations uICEJnBuhy0

Elia Scotto | Website