Spaces:
Sleeping
Sleeping
File size: 396 Bytes
e008495 1cc2027 e008495 1cc2027 e008495 4a8b2d1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | from scrapling.fetchers import Fetcher
def scrape_url(url: str) -> str:
try:
page = Fetcher.get(url)
# ✅ Extract text properly
texts = page.css("body *::text").getall()
# Clean text
cleaned = [t.strip() for t in texts if t.strip()]
return " ".join(cleaned)
except Exception as e:
print("SCRAPING ERROR:", e)
return "" |