Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError 'like_count' #287

Open
colinosoft opened this issue Mar 11, 2021 · 4 comments
Open

KeyError 'like_count' #287

colinosoft opened this issue Mar 11, 2021 · 4 comments

Comments

@colinosoft
Copy link

I'm get information from several videos with a loop and in some I get this error and I don't know how to fix it:

KeyError
'like_count'

@colinosoft
Copy link
Author

Well I am not an expert in python but I realized that the error occurs when trying to get likes or dislikes in video that do not have therefore the json does not bring that key.

Change in the backend_youtube_dl.py file in line 53, the assignment of keys for a get ('') and it works perfectly in the cases that does not have likes returns empty and at least does not indicate a fatal error in execution.

@mts7
Copy link

mts7 commented Mar 29, 2021

#288 fixes it.

jonnor added a commit to soundsensing/audiosetdl that referenced this issue Apr 16, 2021
The pafy has not had any release since 2019

Should fix download errors like KeyError 'like_count',
ref mps-youtube/pafy#287
@tirth-2001
Copy link

Any solution to this yet?

The reason for this error might be youtube API has restructured its response. But that is not incorporated in the youtube_dl package. Whosoever is @author of PAFY package. Please look into this.

@vmc-7645
Copy link

vmc-7645 commented Mar 9, 2023

Kind of a "band aid" solution but simply go to backend_youtube_dl.py under pafy and comment out lines 53 and 54. ie;

from

self._likes = self._ydl_info['like_count']
self._dislikes = self._ydl_info['dislike_count']

to

# self._likes = self._ydl_info['like_count']
# self._dislikes = self._ydl_info['dislike_count']

hopefully an actual fix will come soon enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants