'Difficulties with deploying Discord music bot to Heroku

I was trying to make a Discord music bot and deploy it to Heroku, I tried to use the play command

async def play(ctx, url):
    channel = ctx.message.author.voice.channel
    voice = get(bot.voice_clients, guild=ctx.guild)
    if voice and voice.is_connected():
        await voice.move_to(channel)
    else:
        voice = await channel.connect()
    YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True'}
    FFMPEG_OPTIONS = {
        'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}

    if not get(bot.voice_clients, guild=ctx.guild).is_playing():
        with YoutubeDL(YDL_OPTIONS) as ydl:
            info = ydl.extract_info(url, download=False)
        URL = info['url']
        get(bot.voice_clients, guild=ctx.guild).play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
        get(bot.voice_clients, guild=ctx.guild).is_playing()
        await ctx.send('Bot is playing')

but got the error message from Heroku:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DownloadError: ERROR: No video formats found; please report this issue on https://yt-dl.org/bug

I have tried to reinstall youtube-dl but it didn't work.

If you can help me, that would be great! Thanks.



Solution 1:[1]

This error is coming for that you are using YTDL, and ytdl is now old and the api of ytdl is so old so if you want to make a good music bot for production then use Lavalink

Best Wrappesrs For Lavalink

  • Wavelink
  • Pomice
  • Lavalink
  • Lavasnek_rs

If you want to install these packages just use pip install< Wrappers name >

If you facing any error feel free to join Help server

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DARK FLAME YT