Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Used html module to unescape html characters #194

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
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
9 changes: 8 additions & 1 deletion dynamic/utility.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
""" Required for replacing html escape characters with their corresponding unicode/ascii characters """
Fixed Show fixed Hide fixed
import html

from termcolor import colored
import requests
from rich.console import Console
Expand Down Expand Up @@ -33,6 +36,8 @@
from webdriver_manager.firefox import GeckoDriverManager
from webdriver_manager.microsoft import EdgeChromiumDriverManager



console = Console()


Expand Down Expand Up @@ -190,6 +195,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:
Expand All @@ -199,7 +206,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"]
]

Expand Down