in functions/main.py [0:0]
def parse_related_questions_response_to_list(response):
soup = BeautifulSoup(response, "html.parser")
questions = []
for item in soup.find_all("li"):
# In case there are code tags, remove the tag and just replace with plain text
if item.find("code"):
text = item.find("code").text
# item.code.replace_with(text)
questions += [text]
# In case there are <p> tags within the <li> strip <p>
if item.find("p"):
text = item.find("p").text
# link = soup.new_tag(
# "a",
# # href=url_for("chatui.question", ask=urllib.parse.quote_plus(text)),
# )
# link.string = text
# item.string = ""
# item.append(link)
questions += [text]
if item.string is not None:
# link = soup.new_tag(
# "a",
# # href=url_for(
# # "chatui.question", ask=urllib.parse.quote_plus(item.string)
# # ),
# )
# link.string = item.string
# item.string = ""
# item.append(link)
questions += [item.string]
return questions