How to use youtube-mp3-downloader - 3 common examples

To help you get started, we’ve selected a few youtube-mp3-downloader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github javascriptair / site / other / utils / video.js View on Github external
return new Promise((resolve, reject) => {
    const bar = new ProgressBar()
    const youTubeUrl = `https://youtube.com/${youTubeId}`
    let currentEmoji = getRandomEmoji()
    const emojiUpdateInterval = setInterval(() => currentEmoji = getRandomEmoji(), 1000) // eslint-disable-line

    updateProgress()
    const pulsBarInterval = setInterval(() => bar.pulse(currentEmoji), 60)

    const YD = new YoutubeMp3Downloader({
      ffmpegPath,
      outputPath: path.join(userHome, 'Desktop'),
      youtubeVideoQuality: 'highest',
      queueParallelism: 2,
      progressTimeout: 250,
    })

    YD.download(youTubeId)
    YD.on('finished', ({file}) => {
      cleanup()
      resolve({file, episode})
    })
    YD.on('error', error => {
      cleanup()
      reject(error)
    })
github simonknittel / discord-bot-api / src / plugins / music / index.js View on Github external
import fs from 'fs';
import chalk from 'chalk';
import os from 'os';


const libraryPath = configModule.get().plugins.music.library ? configModule.get().plugins.music.library + '/youtube' : (os.platform() === 'win32' ? 'C:/Windows/Temp/discord-bot-api/youtube' : '/tmp/discord-bot-api/youtube');

const youtubeOptions = {
    outputPath: libraryPath,
    queueParallelism: 10,
};

if (configModule.get().plugins.music.ffmpeg) youtubeOptions.ffmpegPath = configModule.get().plugins.music.ffmpeg;


let YD = new YoutubeMp3Downloader(youtubeOptions);

events.on('config reloaded', () => {
    if (configModule.get().plugins.music.ffmpeg) youtubeOptions.ffmpegPath = configModule.get().plugins.music.ffmpeg;
    YD = new YoutubeMp3Downloader(youtubeOptions);
});

const playlist = []; // All requested songs will be saved in this array
let voiceChannelID = null; // The ID of the voice channel the bot has entered will be saved in this variable
let currentSong = null; // The current song will be saved in this variable
const downloadQueue = {};
let usersWantToSkip = []; // The id of the users that want to skip the current song will be stored in this array
let currentStream = null;

let disableLiveDownloadProgress = true; // Because of rate limiting

let finishedListener = function() { // Wrapper lets this function called only once (because of the weird event emits from the YouTube download library)
github simonknittel / discord-bot-api / src / plugins / music / index.js View on Github external
events.on('config reloaded', () => {
    if (configModule.get().plugins.music.ffmpeg) youtubeOptions.ffmpegPath = configModule.get().plugins.music.ffmpeg;
    YD = new YoutubeMp3Downloader(youtubeOptions);
});

youtube-mp3-downloader

Downloads Youtube videos (in parallel, as streams), encodes the audio data as mp3 and stores them in a defineable location

MIT
Latest version published 3 months ago

Package Health Score

62 / 100
Full package analysis

Popular youtube-mp3-downloader functions

Popular JavaScript code snippets

Find secure code to use in your application or website