yt-transcript-fetcher
v1.0.0
Published
A simple and efficient YouTube transcript fetcher that extracts captions in multiple formats (JSON, TXT, XML) with support for different languages.
Maintainers
Readme
🎬 YouTube Transcript Fetcher
A simple and efficient YouTube transcript fetcher that extracts captions and subtitles from YouTube videos in multiple formats (JSON, text, XML) with support for different languages.
✨ Features
- 🚀 Easy to use - Simple API with minimal setup
- 🌍 Multi-language support - Fetch transcripts in different languages
- 📄 Multiple output formats - JSON, plain text, or XML
- 🌐 Proxy support - Use proxy servers to bypass restrictions
📦 Installation
# Using npm
npm install yt-transcript-fetcher
# Using yarn
yarn add yt-transcript-fetcher
# Using pnpm
pnpm add yt-transcript-fetcher🚀 Quick Start
import YoutubeTranscript from "yt-transcript-fetcher";
// Fetch transcript in JSON format (default)
const transcript = await YoutubeTranscript.fetch("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
console.log(transcript);📚 Usage Examples
Basic Usage
import YoutubeTranscript from "yt-transcript-fetcher";
// Fetch transcript with default settings (English, JSON format)
const transcript = await YoutubeTranscript.fetch("https://www.youtube.com/watch?v=dQw4w9WgXcQ");Different Output Formats
const textTranscript = await YoutubeTranscript.fetch("https://www.youtube.com/watch?v=dQw4w9WgXcQ", {
outputFormat: "text", //xml | json | text
});Different Languages
const spanishTranscript = await YoutubeTranscript.fetch("https://www.youtube.com/watch?v=dQw4w9WgXcQ", {
transcriptLanguage: "es",
});🌐 Proxy Support
The library supports proxy configuration to bypass YouTube restrictions and regional blocks. Here are examples of different proxy configurations:
const transcript = await YoutubeTranscript.fetch("https://www.youtube.com/watch?v=dQw4w9WgXcQ", {
proxy: {
protocol: "https",
host: "secure-proxy.example.com",
port: 8080,
auth: {
username: "your-username",
password: "your-password",
},
},
});🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Built with Axios for HTTP requests
- Inspired by the need for a simple YouTube transcript extraction tool
📞 Support
If you encounter any issues or have questions, please:
- Check the Issues page
- Create a new issue if your problem isn't already reported
- Provide as much detail as possible, including:
- YouTube URL you're trying to fetch
- Error messages
- Node.js version
- Library version
Made with ❤️ by Syed Hasnain
