From a7fb13e4778e6c7ce7392ad5d5c7672b4de45c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Tue, 19 Mar 2019 13:04:56 +0100 Subject: [PATCH] Replace HTML entities in Youtube results --- services/youtube.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/youtube.py b/services/youtube.py index 95f8616..a0ea1ed 100644 --- a/services/youtube.py +++ b/services/youtube.py @@ -1,3 +1,5 @@ +import html + import fuzzywuzzy.fuzz import fuzzywuzzy.process import googleapiclient @@ -46,10 +48,10 @@ class Youtube(object): result.append(dict( kind=kind, url=url, - title=item['snippet']['title'], - description=item['snippet']['description'], + title=html.unescape(item['snippet']['title']), + description=html.unescape(item['snippet']['description']), thumbnail_url=get_thumbnail_url(item['snippet']['thumbnails']), - channel_title=channel['snippet']['title'], + channel_title=html.unescape(channel['snippet']['title']), channel_url='{0}/c/{1}'.format(BASE_URL, channel['snippet']['customUrl']), channel_thumbnail_url=get_thumbnail_url(channel['snippet']['thumbnails']))) count -= resp['pageInfo']['resultsPerPage']