YchKhan commited on
Commit
2817c17
·
verified ·
1 Parent(s): 01c9f58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
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)}"}