Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion dynamic/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
from webdriver_manager.firefox import GeckoDriverManager
from webdriver_manager.microsoft import EdgeChromiumDriverManager

# Required for replacing html escape characters with their corresponding ascii characters
import html

console = Console()


Expand Down Expand Up @@ -183,6 +186,18 @@ def __init__(self):
self.utility = Utility()
self.playbook = Playbook()

def replaceHtmlEscapeCharacters(self, question_title):
"""
Function to replace HTML escape characters in question's title
to their corresponding ASCII characters
For example, if the title was something like this:
'"static const" vs "#define" vs "enum"'
the HTML escape characters would be replaced with their corresponding ASCII
characters and the resulting string would be:
'"static const" vs "#define" vs "enum"'
"""
return html.unescape(question_title)

def populate_question_data(self, questions_list):
"""
Function to populate question data property
Expand All @@ -199,7 +214,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"]]
[self.replaceHtmlEscapeCharacters(item["title"].replace("|", "")), item["question_id"], item["link"]]
for item in json_ques_data["items"]
]

Expand Down