项目详情
深入了解 Scrapegraph-ai 的功能与特性
🕷️ ScrapeGraphAI: 你只需采集一次
English | 中文 | 日本語 | 한국어 | Русский | Türkçe
ScrapeGraphAI 是一个使用大语言模型(LLM)和直接图形逻辑的网络数据采集Python库,专为构建网站和本地文档(如XML、HTML、JSON、Markdown等)的数据采集管道而设计。
只需告诉它你想提取的信息,这个库就会为你完成任务!
🚀 快速安装
Scrapegraph-ai 的参考页面可以在PyPI的官方网站上找到: pypi。
pip install scrapegraphai
# 重要提示(用于获取网站内容)
playwright install
注意: 建议在虚拟环境中安装该库以避免与其他库的冲突 🐱
💻 用法
可以使用多种标准的数据采集管道从网站(或本地文件)中获取信息。
最常用的是 SmartScraperGraph,它能够根据用户的提示与源网址提取单个页面信息。
scrapegraphai.graphs SmartScraperGraph
graph_config = {
: {
: ,
: ,
},
: ,
: ,
}
smart_scraper_graph = SmartScraperGraph(
prompt=,
source=,
config=graph_config
)
result = smart_scraper_graph.run()
json
(json.dumps(result, indent=))
