Skip to content
EhsanFox edited this page Apr 22, 2022 · 4 revisions

Music-Engines

music-engines-logo

music-engines is a package to fetch a music/artist/album or even playlist from the platform you choose, there multi platforms that are supported in this package, so there is no need for any others....

Table of Contents

Why music-engines?

music-engine currently Supports 4 biggest platform that we all know all-in-one package and access to the Audio buffers directly from the platform API, so we are all-in-one and we have download feature

Installation

  • Using NPM

npm install music-engines

  • Using yarn

yarn add music-engines

Features

  • Custom Data Wrapper
  • No Token Required
  • Music Buffers (sometimes FFMPEG or Opus)

Platforms

  • YouTube
  • SoundCloud
  • Spotify
  • Deezer
  • Radio Javan (Maybe, maybe not)

Documents

Documents are live at /music-engines

Examples

YouTube Downloader

const { YouTube } = require("music-engines");
const myEngine = new YouTube();

myEngine.use('https://www.youtube.com/watch?v=KQlyGYCKGGA', { format: true })
.then(resultArray => {
    const track = resultArray[0];
    const audioBuffer = track.stream()
    audioBuffer.pipe(fs.createWritestream("music.mp3"))
})
.catch(console.error)

Discord Bot

const { YouTube } = require("music-engines");
const myEngine = new YouTube();

myEngine.use('https://www.youtube.com/watch?v=KQlyGYCKGGA', { format: true })
.then(resultArray => {
    const track = resultArray[0];

    // Disabling chunking is recommended in Discord bots
    const audioBuffer = track.stream({ filter: 'audioonly', dlChunkSize: 0 })
    // Discord.js Stuff....
    const connection = await voiceChannel.join();
    const dipatcher = connection.play(audioBuffer)
        
    // Enjoy the Music
})
.catch(console.error)
  • More Examples would be added soon (PR's are welcome)

Credits

  • Thanks to Kambiz for all the helps on the package and Future PR's

Music Engines Docs

Clone this wiki locally