yt-script
v1.0.10
Published
get subtitles for any YouTube video
Downloads
18
Readme
yt-script
yt-script is a command-line tool for fetching and formatting YouTube video transcripts. It supports multiple languages, various output formats, and optional translation of transcripts.
Table of Contents
Features
- Fetches transcripts for YouTube videos.
- Supports multiple languages.
- Outputs transcripts in various formats (pretty, JSON, plain text).
- Option to translate transcripts to different languages.
- Lists available languages for transcripts.
Installation
Global Installation
To install yt-script
globally, run:
npm install -g .
Local Installation
To install yt-script
locally for development or testing, run:
npm install .
Usage
Fetching Transcripts
The basic command to fetch a transcript is:
yt-script <video_id_or_url>
Options
--list-transcripts
: List available languages for the given videos.--languages <languages...>
: List of languages in descending priority (default:['en']
).--format <format>
: Output format (pretty
,json
,text
, default:pretty
).--translate <language>
: Language to translate the transcript to.
Examples
Fetch transcript in default format (pretty):
yt-script https://www.youtube.com/watch?v=abcd1234EFG
Fetch transcript in JSON format:
yt-script https://www.youtube.com/watch?v=abcd1234EFG --format json
Fetch transcript and translate to French:
yt-script https://www.youtube.com/watch?v=abcd1234EFG --translate fr
List available languages for a video:
yt-script https://www.youtube.com/watch?v=abcd1234EFG --list-transcripts
Fetch transcript with multiple languages prioritized:
yt-script https://www.youtube.com/watch?v=abcd1234EFG --languages en fr de
Development
For development, clone the repository and install the dependencies:
git clone https://github.com/zshmeta/ytScript.git
cd ytScript
npm install
Run the script locally:
node index.js <video_id_or_url>