Playing a specific YouTube video from a Bot

Hi, I’m trying to create a command that plays audio from a specific YouTube video for 4 seconds and then leaves. I have the timing commands right, but the audio just doesn’t want to play, and I can’t discern why. After hours of research, I came up with some code, but it returns the error:


"<YouTube Link>: Invalid data found when processing input"

I can’t tell what’s wrong, or how to get audio playing in the first place. I also tried installing ffmpeg both through pip and through direct download, but I can’t get that to work. If someone could help, that would be great, thanks in advance.

@client.command(name="playvideo")
async def join(ctx):
#CONNECTS BOT
user = ctx.message.author
channel = user.voice.channel
await channel.connect()

#SUPPOSED TO BE PLAYING AUDIO
guild = ctx.guild
voice_client: discord.VoiceClient = discord.utils.get(client.voice_clients, guild=guild)
audio_source = discord.FFmpegPCMAudio('insert video here')
if not voice_client.is_playing():
voice_client.play(audio_source, after=None)

#WAITS FOR FOUR SECONDS THEN LEAVES
await asyncio.sleep(4)
await ctx.voice_client.disconnect()

  

do you still need help? i found a solution

I have same issue Could you tell me the solution?