Spaces:
Runtime error
Runtime error
Download tools/scrape_website.py from beautiful-code/ai_workflows: direct link, hf CLI and curl.
- Browser
- Download file 438 Bytes
-
https://huggingface.co/spaces/beautiful-code/ai_workflows/resolve/refs%2Fpr%2F1/tools/scrape_website.py
- Command line
-
hf download hf://spaces/beautiful-code/ai_workflows@refs/pr/1/tools/scrape_website.py
-
curl -L -o scrape_website.py https://huggingface.co/spaces/beautiful-code/ai_workflows/resolve/refs%2Fpr%2F1/tools/scrape_website.py
438 Bytes
| from crewai_tools import ScrapeWebsiteTool | |
| import requests | |
| from bs4 import BeautifulSoup | |
| scrape_tool = ScrapeWebsiteTool() | |
| def CustomScrapeWebsiteTool(url): | |
| response = requests.get(url) | |
| parsed = BeautifulSoup(response.content, "html.parser") | |
| text = parsed.get_text() | |
| text = '\n'.join([i for i in text.split('\n') if i.strip() != '']) | |
| text = ' '.join([i for i in text.split(' ') if i.strip() != '']) | |
| return text | |