using direct link gives no results but searching does.

I haven't used this library at all but I've used some that are similar to it in the past (erela.js, vulkava, etc...). I picked it because it was the most familiar feeling but I'm running into an issue with direct links in my first implementation. Here is the code I use to play tracks and attached to this post is the logs from the console
const player = client.moonlink.createPlayer({
guildId: interaction.guild.id,
voiceChannelId: voiceChannel.id,
textChannelId: interaction.channel.id,
});

await client.moonlink
.search({
query,
source: "youtube",
requester: interaction.user.id,
})
.then(async (res) => {
console.log(res);
switch (res.loadType) {
case "track":
player.queue.add(res.tracks[0]);
if (!player.playing) player.play();
interaction.reply(
`Enqueued [${res.tracks[0].info.title}](${res.tracks[0].info.uri})`
);
break;
}
});
const player = client.moonlink.createPlayer({
guildId: interaction.guild.id,
voiceChannelId: voiceChannel.id,
textChannelId: interaction.channel.id,
});

await client.moonlink
.search({
query,
source: "youtube",
requester: interaction.user.id,
})
.then(async (res) => {
console.log(res);
switch (res.loadType) {
case "track":
player.queue.add(res.tracks[0]);
if (!player.playing) player.play();
interaction.reply(
`Enqueued [${res.tracks[0].info.title}](${res.tracks[0].info.uri})`
);
break;
}
});
edit: forgot to mention that the value of query is interaction.options.getString("query") I have also tried different links
No description
Solution:
I didn't read the lavalink logs properly and it ended up being that they depricated their out-of-the-box youtube support so I had to install a plugin. Thank you so much for your help regardless ❤️
Jump to solution
2 Replies
1Lucas1.apk
1Lucas1.apk6mo ago
const player = client.moonlink.createPlayer({ guildId: interaction.guild.id, voiceChannelId: voiceChannel.id, textChannelId: interaction.channel.id, }); let res = await client.moonlink .search({ query, source: "youtube", requester: interaction.user.id, }) switch (res.loadType) { case "track": player.queue.add(res.tracks[0]); if (!player.playing) player.play(); interaction.reply( Enqueued [${res.tracks[0].info.title}](${res.tracks[0].info.uri}) ); break; } try
Solution
katsu
katsu6mo ago
I didn't read the lavalink logs properly and it ended up being that they depricated their out-of-the-box youtube support so I had to install a plugin. Thank you so much for your help regardless ❤️

Did you find this page helpful?