Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -143,8 +143,7 @@ def extract_page_content(url: str, max_char: int = 5000):
|
|
143 |
|
144 |
soup = BeautifulSoup(response.text, 'html.parser')
|
145 |
full_text = soup.get_text()
|
146 |
-
|
147 |
-
text = full_text[:max_char]
|
148 |
return {"text_content": text}
|
149 |
except requests.RequestException as e:
|
150 |
return {"error": f"Error fetching the page: {str(e)}"}
|
|
|
143 |
|
144 |
soup = BeautifulSoup(response.text, 'html.parser')
|
145 |
full_text = soup.get_text()
|
146 |
+
text = re.sub(r'\n+', ' ', full_text)[:max_char]
|
|
|
147 |
return {"text_content": text}
|
148 |
except requests.RequestException as e:
|
149 |
return {"error": f"Error fetching the page: {str(e)}"}
|