Skip to content

Commit

Permalink
Remove like/dislike from LinkInfo YouTube integration
Browse files Browse the repository at this point in the history
YouTube is removing dislike counts from API responses on December 13th, 2021.
  • Loading branch information
alanbriolat authored Nov 17, 2021
1 parent 1d8c10b commit ec1dd35
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/csbot/plugins/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Youtube(Plugin):
'api_key': ['YOUTUBE_DATA_API_KEY'],
}

RESPONSE = '"{title}" [{duration}] (by {uploader} at {uploaded}) | Views: {views} [{likes}]'
RESPONSE = '"{title}" [{duration}] (by {uploader} at {uploaded}) | Views: {views}'
CMD_RESPONSE = RESPONSE + ' | {link}'

async def get_video_json(self, id):
Expand Down Expand Up @@ -130,13 +130,6 @@ async def _yt(self, url):
except KeyError:
vid_info["views"] = "N/A"

try:
likes = int(json["statistics"]["likeCount"])
dislikes = int(json["statistics"]["dislikeCount"])
vid_info["likes"] = "+{:,}/-{:,}".format(likes, dislikes)
except KeyError:
vid_info["likes"] = "N/A"

return vid_info

@Plugin.integrate_with('linkinfo')
Expand Down

0 comments on commit ec1dd35

Please sign in to comment.