Fix videos without dislikes or likes (#123)
This commit is contained in:
parent
2b496ad70e
commit
ff2d8e67d3
@ -36,15 +36,15 @@ def get_info(url):
|
|||||||
if(info['like_count'] == None):
|
if(info['like_count'] == None):
|
||||||
video['like_count'] = 0
|
video['like_count'] = 0
|
||||||
else:
|
else:
|
||||||
video['like_count'] = info['like_count']
|
video['like_count'] = int(info['like_count'])
|
||||||
|
|
||||||
if(info['dislike_count'] == None):
|
if(info['dislike_count'] == None):
|
||||||
video['dislike_count'] = 0
|
video['dislike_count'] = 0
|
||||||
else:
|
else:
|
||||||
video['dislike_count'] = info['dislike_count']
|
video['dislike_count'] = int(info['dislike_count'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
video['total_likes'] = int(info['dislike_count']) + int(info['like_count'])
|
video['total_likes'] = info['dislike_count'] + info['like_count']
|
||||||
except:
|
except:
|
||||||
video['total_likes'] = ""
|
video['total_likes'] = ""
|
||||||
video['average_rating'] = str(info['average_rating'])[0:4]
|
video['average_rating'] = str(info['average_rating'])[0:4]
|
||||||
|
Reference in New Issue
Block a user