diff --git a/dynamic/utility.py b/dynamic/utility.py index 9faf891..0fb6e00 100644 --- a/dynamic/utility.py +++ b/dynamic/utility.py @@ -1,3 +1,7 @@ +""" Required for replacing html escape characters with their + corresponding unicode/ascii characters """ +import html + from termcolor import colored import requests from rich.console import Console @@ -33,6 +37,8 @@ from webdriver_manager.firefox import GeckoDriverManager from webdriver_manager.microsoft import EdgeChromiumDriverManager + + console = Console() @@ -190,6 +196,8 @@ def populate_question_data(self, questions_list): details of questions with id in the list. Stores the returned data in the following format: list( list( question_title, question_link, question_id ) ) + Uses html.unescape function to convert html character references + to the corresponding unicode to corresponding unicode characters """ with console.status("Getting the questions..."): try: @@ -199,7 +207,7 @@ def populate_question_data(self, questions_list): sys.exit() json_ques_data = resp.json() self.questions_data = [ - [item["title"].replace("|", ""), item["question_id"], item["link"]] + [html.unescape(item["title"].replace("|", "")), item["question_id"], item["link"]] for item in json_ques_data["items"] ]