| from langchain.tools import tool | |
| import trafilatura | |
| def visit_webpage(url: str) -> str: | |
| """Fetch and return the text content of a web page.""" | |
| downloaded = trafilatura.fetch_url(url) | |
| if downloaded: | |
| text = trafilatura.extract(downloaded) or "" | |
| return text[:15000] | |
| return "Error: could not fetch page" | |