Update app.py
Browse files
app.py
CHANGED
@@ -55,10 +55,13 @@ def extract_images(soup, base_url):
|
|
55 |
return images
|
56 |
|
57 |
def format_detailed_output(structured_data, title):
|
58 |
-
"""Formats the structured data into a Markdown string."""
|
59 |
result = f"### Title\n\n{title}\n\n"
|
60 |
result += "### Texts\n\n"
|
61 |
-
|
|
|
|
|
|
|
62 |
result += "\n\n### Links\n\n"
|
63 |
if structured_data["Links"]:
|
64 |
result += "\n".join(f"[{link['Text']}]({link['URL']})" for link in structured_data["Links"])
|
|
|
55 |
return images
|
56 |
|
57 |
def format_detailed_output(structured_data, title):
|
58 |
+
"""Formats the structured data into a Markdown string with each text, link, and image on a new line."""
|
59 |
result = f"### Title\n\n{title}\n\n"
|
60 |
result += "### Texts\n\n"
|
61 |
+
if structured_data["Texts"]:
|
62 |
+
result += "\n".join(structured_data["Texts"])
|
63 |
+
else:
|
64 |
+
result += "No textual content found."
|
65 |
result += "\n\n### Links\n\n"
|
66 |
if structured_data["Links"]:
|
67 |
result += "\n".join(f"[{link['Text']}]({link['URL']})" for link in structured_data["Links"])
|