Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

178
Vistas
Discord Music Bot Youtube Playlists not working

Hello I am trying to solve a problem with a Discord Music Bot, it works fine with Spotify songs and playlists, but Youtube playlists no (although songs it does work). I can add song by song to the queue but not a list.

This is the error:

music_message 476:TypeError: arr is not iterable

in this part of the code:

 if (isYoutube(qry) && isYoutubePlaylist(qry)) {
     try {
         const arr = await youtube_tracks_from_playlist(qry);
         for (let item of arr)
             addToQueue(item, mapKey)
         message.react(EMOJI_GREEN_CIRCLE)
     } catch (e) {
         console.log('music_message 476:' + e)
         message.channel.send('Failed to process playlist: ' + qry);
     }
 }

But due to the fact that the error is that it cannot be iterated I guess the error comes from before and the format of the object. So here is the function:

async function youtube_tracks_from_playlist(url, isretry=false) {
    const data = await ytlist(url, 'url');
    console.log("Type of youtube data: " + typeof data)
    console.log("Data: " + data)
    if (data && 'data' in data && 'playlist' in data.data && data.data.playlist && data.data.playlist.length) {
        return data.data.playlist
    } else {
        if (!isretry) {
            console.log('retrying yt playlist processing')
            return await youtube_tracks_from_playlist(url, true);
        } else {
            return null;
        }
    }
}

And in case it helps here are the outputs of the console to types of data and ytlist def:

const ytlist = require('youtube-playlist');

Type of youtube data: object

Data: [object Object]

Type of arr: object

arr: null

So, I have no clue if that [object Object] is the common thing I am supposed to get, or what is the problem?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda