vcyaudio
v1.0.1
Published
High-performance Universal Audio Engine for Discord Bots
Maintainers
Readme
🔊 vcyaudio
High-Performance Universal Audio Extractor Engine for Node.js
Powered by Golang | Zero-FFmpeg Transcoding | Optimized for Discord Bots
📖 Overview
vcyaudio is a high-efficiency audio extraction module utilizing a bridge architecture between Golang and Node.js. Specifically designed for Discord music bots that require high speed, low CPU usage, and native Opus support without the need for external FFmpeg transcoding.
🚀 Key Features
| Feature | Description | |---------|-------------| | ⚡ Golang Core | Utilizes a high-speed Go execution binary to handle heavy scraping and URL decryption | | 🔇 Zero-FFmpeg | Specifically extracts WebM Opus format (Google itag 251). Audio can be played natively in Discord without re-encoding | | 📡 Universal Router | Supports YouTube direct links & search queries, Spotify & TIDAL with metadata fallback | | 📜 Smart Playlist | YouTube playlist extraction (up to 50 tracks) with "Lazy Loading" schema | | 📉 Low Resource | Zero disk usage (no temporary files) and minimal RAM footprint on your VPS |
🏗 System Architecture
The module operates by spawning a lightweight Go binary in the background. Node.js sends instructions via CLI arguments, and Go returns a clean JSON object through Standard Output (stdout).
┌─────────────┐ CLI Args ┌─────────────┐
│ Node.js │ ────────────────► │ Go Binary │
│ (vcyaudio) │ │ (Extractor)│
└─────────────┘ └─────────────┘
▲ │
│ JSON (stdout) │
└──────────────────────────────────┘📦 Installation
Prerequisites
- Node.js (v14 or higher)
- Go 1.19+ (for building binaries)
Setup
# Navigate to vcyaudio directory
cd vcyaudio
# Install dependencies
npm install
# Build binaries for Windows & Linux
npm run build:all
# Link the module globally
npm linkConnect to Your Bot
# Navigate to your bot project
cd ../your-bot-folder
# Link vcyaudio to your project
npm link vcyaudio📖 Usage Guide
1. Single Track Extraction / Text Search
Ideal for commands like !play <title/link>:
const vcyaudio = require('vcyaudio');
const { createAudioResource, StreamType } = require('@discordjs/voice');
async function playMusic(urlOrText) {
const result = await vcyaudio.getStream(urlOrText);
if (result.status === 'success') {
// Play directly WITHOUT FFmpeg
const resource = createAudioResource(result.stream_url, {
inputType: StreamType.WebmOpus,
});
console.log(`Now playing: ${result.title}`);
return resource;
}
}2. Playlist Handling (Lazy Loading)
Use this to prevent the bot from hanging when processing hundreds of tracks at once:
const result = await vcyaudio.getStream("https://youtube.com/playlist?list=...");
if (result.type === 'playlist') {
console.log(`Playlist Name: ${result.playlist_name}`);
// Iterate through track titles to add to your queue
result.tracks.forEach(track => {
const query = track.query; // e.g., "Song Title - Artist"
myBotQueue.push(query);
});
}🛠 JSON Response Schema
Every request returns an object with the following structure:
| Key | Type | Description |
|-----|------|-------------|
| status | string | "success" or "error" |
| type | string | "track" or "playlist" |
| title | string | Song title or Playlist name |
| stream_url | string | Direct audio link (only for type: track) |
| tracks | array | List of song objects (only for type: playlist) |
| message | string | Error message if the status fails |
🖥 OS Support
vcyaudio automatically detects the operating system and runs the appropriate binary located in the bin/ folder:
| OS | Binary | Architecture |
|----|--------|--------------|
| Windows | vcyaudio-win.exe | amd64 |
| Linux | vcyaudio-linux | amd64 |
🛠 Maintenance
If YouTube updates its system and extraction fails, simply update the Go dependencies and recompile:
# Update Go dependencies
go get -u github.com/kkdai/youtube/v2
# Rebuild all binaries
npm run build:all📂 Project Structure
vcyaudio/
├── bin/ # Compiled Go binaries
│ ├── vcyaudio-linux
│ └── vcyaudio-win.exe
├── src/ # Go source code
│ ├── main.go
│ ├── go.mod
│ └── go.sum
├── index.js # Node.js entry point
├── package.json
└── README.md⚠️ Important Notes
- This module is designed for educational and personal use
- Ensure compliance with YouTube's Terms of Service when using this module
- No temporary files are created - all processing is done in-memory
- Requires stable internet connection for audio stream extraction
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is proprietary software developed internally by vcyanh.
👤 Author
Developed with ❤️ by Cejii (vcyanh)
📞 Support
For issues, questions, or suggestions, please open an issue on the GitHub repository.
