Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda