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_urlstring必填 读取文件的网站URL。这是工具的主要输入,指定应抓取和读取哪个网站的内容。

这个页面有帮助吗?