ScrapeWebsiteTool
我们仍在努力改进工具,因此未来可能会出现意外行为或变更。
一个旨在提取并读取指定网站内容的工具。它能够通过发起 HTTP 请求并解析接收到的 HTML 内容来处理各种类型的网页。该工具对于网络抓取任务、数据收集或从网站提取特定信息特别有用。
安装 crewai_tools 包
pip install 'crewai[tools]'
from crewai_tools import ScrapeWebsiteTool
# To enable scrapping any website it finds during it's execution
tool = ScrapeWebsiteTool()
# Initialize the tool with the website URL,
# so the agent can only scrap the content of the specified website
tool = ScrapeWebsiteTool(website_url='https://www.example.com')
# Extract the text from the site
text = tool.run()
print(text)
| 参数 | 类型 | 描述 |
|---|
| website_url | 字符串 | 必需的用于读取文件的网站 URL。这是该工具的主要输入,指定应抓取和读取哪个网站的内容。 |