diff --git a/coding_love.py b/coding_love.py index e4208a7..d15a539 100644 --- a/coding_love.py +++ b/coding_love.py @@ -1,5 +1,6 @@ import requests import re +import html url = "https://thecodinglove.com/" @@ -7,7 +8,10 @@ url = "https://thecodinglove.com/" def send_coding_love_gif(bot, update): random_url = re.search('href="(.*)".*\n.*random\(\)', requests.get(url).text).group(1) - random_page_content = requests.get(random_url).text + random_page_content = requests.get(random_url) + random_page_content.encoding = 'utf-8' + random_page_content = html.unescape(random_page_content.text) + caption = re.search('blog-post-title">(.*)', random_page_content).group(1) gif_match = re.search('data="(.*)" type="image/gif"', random_page_content)