Yousefrofa
Yousefrofa

Reputation: 1

dislike_count with pafy and youtube_dl

I have a code for a discord bot that plays music in voice channels and since youtube removed the dislike counter on video i get an error

nextcord.errors.ApplicationInvokeError: Command raised an exception: KeyError: 'dislike_count'

I tried to change the backend_youtube_dl.py file and it worked, but the thing is I am using Heroku to run the code and I can't change the file there

the code is quite large but this is the part causing the problem

async def play_song(self, interaction, link):
    vid = pafy.new(link)
    url = vid.getbestaudio().url
    interaction.guild.voice_client.play(discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(url)), after=lambda e: self.bot.loop.create_task(self.check_queue(interaction)))

Is there any other way to fix this?

Upvotes: 0

Views: 78

Answers (1)

Benjamin Loison
Benjamin Loison

Reputation: 5612

pip install git+https://github.com/mps-youtube/pafy.git

Installs the latest Jul 17, 2021 version which doesn't have the issue you are mentioning, while using pip install pafy installs the Nov 22, 2019 version which has the issue you are mentioning.

Upvotes: 0

Related Questions