pafy로 youtube link 가져올 때 아래처럼 dislike_count나 like_count KeyError가 발생하는 경우
File c:\Users\netxy\AppData\Local\Programs\Python\Python310\lib\site-packages\pafy\pafy.py:124, in new(url, basic, gdata, size, callback, ydl_opts)
121 else:
122 from .backend_youtube_dl import YtdlPafy as Pafy
--> 124 return Pafy(url, basic, gdata, size, callback, ydl_opts=ydl_opts)
File c:\Users\netxy\AppData\Local\Programs\Python\Python310\lib\site-packages\pafy\backend_youtube_dl.py:31, in YtdlPafy.__init__(self, *args, **kwargs)
29 if ydl_opts:
30 self._ydl_opts.update(ydl_opts)
---> 31 super(YtdlPafy, self).__init__(*args, **kwargs)
...
---> 54 self._dislikes = self._ydl_info['dislike_count']
55 self._username = self._ydl_info['uploader_id']
56 self._category = self._ydl_info['categories'][0] if self._ydl_info['categories'] else ''
KeyError: 'dislike_count'
backend_youtube_dl.py의 아래부분을 주석처리 해주면 됩니다.
Python\Python310\lib\site-packages\pafy\backend_youtube_dl.py
#self._likes = self._ydl_info['like_count']
#self._dislikes = self._ydl_info['dislike_count']