A lightweight and efficient CLI tool for fetching YouTube subtitles or transcripts effortlessly. 🚀
- 🎥 Fetch subtitles or transcripts for any YouTube video.
- 🌍 Supports specifying language codes.
- 📝 Outputs a clean, plain-text transcript.
- 🛠️ Easy-to-use CLI interface.
- 🔗 New: Copy the transcript to clipboard with
--copy
option.
You can use yt-sub-fetch
directly via npx without any prior installation:
npx yt-sub-fetch <YouTube URL> [langCode] [--copy]
npx yt-sub-fetch <YouTube URL>
Example:
npx yt-sub-fetch https://youtu.be/ekr2nIex040
You can specify a language code to fetch subtitles in a specific language. Default is English (en
).
npx yt-sub-fetch <YouTube URL> <langCode>
Example:
npx yt-sub-fetch https://youtu.be/ekr2nIex040 es
In this example, the tool will attempt to fetch Spanish subtitles (es
).
Use the --copy
option to automatically copy the transcript to your clipboard after fetching.
npx yt-sub-fetch <YouTube URL> --copy
Example:
npx yt-sub-fetch https://youtu.be/ekr2nIex040 --copy
This will fetch the subtitles and copy the content to your clipboard for easy pasting.
The tool will output the transcript in the following format:
Title: [Video Title]
Transcript:
[Transcript Text]
Example output:
Title: ROSÉ & Bruno Mars - APT. (Official Music Video)
Transcript:
[Music] start uhhuh [Music] uhuh uh uhhuh uh-huh kissy face kissy face sent to your phone butt I'm trying to kiss your Li for real...
If the --copy
option is used, the transcript will also be copied to your clipboard.
- ✅ Ensure the YouTube URL is valid.
- 🌐 Verify that subtitles are available for the requested language.
- 📶 Check your internet connection.
- 🐛 If you encounter any issues, feel free to report them on the GitHub repository.
Developed with ❤️ by Aung Myo Kyaw
This project is licensed under the MIT License. See the LICENSE file for details.