I have a problem with dislike error when creating an pafy.new url, perhaps it's because youtube hid numer of dislikes

11.7k Views Asked by At
import pafy
import vlc
url = "https://www.youtube.com/watch?v=h_D3VFfhvs4"
video = pafy.new(url)

KeyError: 'dislike_count'

4

There are 4 best solutions below

3
Ismaeel Akach On

just comment the line 53 and 54 from backend_youtube_dl.py in your pafy packages path

0
snarik On

There's a less heinous solution than editing package files by using an older version of youtube-dl.

Just run pip install youtube-dl==2020.12.2

2
thenanosoft On

I face this same issue [solved]:

Here is problem screenshot: Key Error Pafy "dislike_count"

How solve this issue?

1: Open Pafy package directory pafy keyword dislike_count issue

2: Open backend_youtube_dl.py file in any txt editor

3: Add comment line number 54 pafy keyword dislike_count solution

pafy dislike_count error solved

0
Peques On

Or you can replace these two lines

self._likes = self._ydl_info.get('like_count',0)
self._dislikes = self._ydl_info.get('dislike_count',0)

https://github.com/mps-youtube/pafy/pull/288