Scrapegraph-ai

ScrapeGraphAIMIT活跃维护

用大语言模型驱动的 Python 爬虫,只需描述想抓什么,就能自动完成网页抓取和结构化数据提取,省去手写解析规则。

Python scraper based on AI

v2.3.1发布于 2026-10-06 08:28 UTC32,673star +64 / 7 天3,330fork同步于 2026-11-10 05:20 UTC

怎么上手

由 README 提炼,执行前请确认
pip install scrapegraphai
playwright install
硬件要求按 README 说明

README 未说明显存或 GPU 要求;本地模型需先安装 Ollama 并用 ollama pull 下载模型,其余可走云端 LLM API

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 LLM 加图流程按自然语言提示抓取网页和本地文档的 Python 库

用大语言模型驱动的 Python 爬虫,只需描述想抓什么,就能自动完成网页抓取和结构化数据提取,省去手写解析规则。

核心能力

  • 用 LLM 加图逻辑自动生成抓取流程
  • 只需一句提示词描述要抽取的信息
  • 提供 SmartScraperGraph 等单页与多页流程
  • 支持 OpenAI、Groq、Gemini、Azure 及 Ollama 本地模型
  • 多页版本可并行调用 LLM

容易踩的坑

装完库还需执行 playwright install 才能抓取网页内容;用本地模型要另装 Ollama 并手动 pull 模型;建议在虚拟环境中安装以避免依赖冲突

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README
这个条目还没有人工点评。如果它对你很有用,欢迎到 提交仓库 页写下你的使用经验。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    最近发版

    5 个版本v2.3.1
    1. v2.3.1最新正式版2026-10-06 · 2026-10-06 08:28 UTC

      2.3.1 (2026-10-06)

      Bug Fixes

      • utils: keep Optional fields in transform_schema (#1160) (9906c69)
    2. v2.3.02026-09-25 · 2026-09-25 14:26 UTC
      查看更新说明

      2.3.0 (2026-09-25)

      Features

      • models: add Cheaper Inference OpenAI-compatible model wrapper (2dcc16e)
      • models: add Cheaper Inference OpenAI-compatible model wrapper (b6dd13e)

      CI

      • release: 2.3.0-beta.1 [skip ci] (8daad01)
    3. v2.3.0-beta.1pre-release2026-09-25 · 2026-09-25 14:19 UTC
      查看更新说明

      2.3.0-beta.1 (2026-09-25)

      Features

      • models: add Cheaper Inference OpenAI-compatible model wrapper (2dcc16e)
      • models: add Cheaper Inference OpenAI-compatible model wrapper (b6dd13e)
    4. v2.2.42026-09-07 · 2026-09-07 13:49 UTC
      查看更新说明

      2.2.4 (2026-09-07)

      Bug Fixes

      • 🐛 read SCRAPEGRAPHAI_TELEMETRY_ENABLED from the environment, not the config file (8769c3b)
      • models: add Gemini 2.5 token limits so they are not truncated to 8192 (c21af20)
      • fetch: surface HTTP errors and missing content instead of answering NA (f91478e), closes #1102 #1102

      CI

    5. v2.2.4-beta.1pre-release2026-09-07 · 2026-09-07 13:46 UTC
      查看更新说明

      2.2.4-beta.1 (2026-09-07)

      Bug Fixes

      • 🐛 read SCRAPEGRAPHAI_TELEMETRY_ENABLED from the environment, not the config file (8769c3b)
      • models: add Gemini 2.5 token limits so they are not truncated to 8192 (c21af20)
      • fetch: surface HTTP errors and missing content instead of answering NA (f91478e), closes #1102 #1102

      CI

      • release: 2.2.0-beta.10 [skip ci] (0bb8bc9)
      • release: 2.2.0-beta.7 [skip ci] (decfc6b)
      • release: 2.2.0-beta.8 [skip ci] (d59c3df), closes #1102 #1102
      • release: 2.2.0-beta.9 [skip ci] (3047ef8)

    README 原文

    未翻译

    🚀 Looking for an even faster and simpler way to scrape at scale (only 5 lines of code)? Check out our enhanced version at ScrapeGraphAI.com! 🚀


    🕷️ ScrapeGraphAI: You Only Scrape Once

    English | 中文 | 日本語 | 한국어 | Русский | Türkçe | Deutsch | Español | français | Português | Italiano

    PyPI Downloads

    License: MIT

    ScrapeGraphAI is a web scraping python library that uses LLM and direct graph logic to create scraping pipelines for websites and local documents (XML, HTML, JSON, Markdown, etc.).

    Just say which information you want to extract and the library will do it for you!

    🚀 Integrations

    ScrapeGraphAI offers seamless integration with popular frameworks and tools to enhance your scraping capabilities. Whether you're building with Python or Node.js, using LLM frameworks, or working with no-code platforms, we've got you covered with our comprehensive integration options..

    You can find more informations at the following link

    Integrations:

    🚀 Quick install

    The reference page for Scrapegraph-ai is available on the official page of PyPI: pypi.

    pip install scrapegraphai
    
    # IMPORTANT (for fetching websites content)
    playwright install
    

    Note: it is recommended to install the library in a virtual environment to avoid conflicts with other libraries 🐱

    💻 Usage

    There are multiple standard scraping pipelines that can be used to extract information from a website (or local file).

    The most common one is the SmartScraperGraph, which extracts information from a single page given a user prompt and a source URL.

    from scrapegraphai.graphs import SmartScraperGraph
    
    # Define the configuration for the scraping pipeline
    graph_config = {
        "llm": {
            "model": "ollama/llama3.2",
            "model_tokens": 8192,
            "format": "json",
        },
        "verbose": True,
        "headless": False,
    }
    
    # Create the SmartScraperGraph instance
    smart_scraper_graph = SmartScraperGraph(
        prompt="Extract useful information from the webpage, including a description of what the company does, founders and social media links",
        source="https://scrapegraphai.com/",
        config=graph_config
    )
    
    # Run the pipeline
    result = smart_scraper_graph.run()
    
    import json
    print(json.dumps(result, indent=4))
    

    [!NOTE] For OpenAI and other models you just need to change the llm config!

    graph_config = {
       "llm": {
           "api_key": "YOUR_OPENAI_API_KEY",
           "model": "openai/gpt-4o-mini",
       },
       "verbose": True,
       "headless": False,
    }
    

    The output will be a dictionary like the following:

    {
        "description": "ScrapeGraphAI transforms websites into clean, organized data for AI agents and data analytics. It offers an AI-powered API for effortless and cost-effective data extraction.",
        "founders": [
            {
                "name": "",
                "role": "Founder & Technical Lead",
                "linkedin": "https://www.linkedin.com/in/perinim/"
            },
            {
                "name": "Marco Vinciguerra",
                "role": "Founder & Software Engineer",
                "linkedin": "https://www.linkedin.com/in/marco-vinciguerra-7ba365242/"
            },
            {
                "name": "Lorenzo Padoan",
                "role": "Founder & Product Engineer",
                "linkedin": "https://www.linkedin.com/in/lorenzo-padoan-4521a2154/"
            }
        ],
        "social_media_links": {
            "linkedin": "https://www.linkedin.com/company/101881123",
            "twitter": "https://x.com/scrapegraphai",
            "github": "https://github.com/ScrapeGraphAI/Scrapegraph-ai"
        }
    }
    

    There are other pipelines that can be used to extract information from multiple pages, generate Python scripts, or even generate audio files.

    Pipeline NameDescription
    SmartScraperGraphSingle-page scraper that only needs a user prompt and an input source.
    SearchGraphMulti-page scraper that extracts information from the top n search results of a search engine.
    SpeechGraphSingle-page scraper that extracts information from a website and generates an audio file.
    ScriptCreatorGraphSingle-page scraper that extracts information from a website and generates a Python script.
    SmartScraperMultiGraphMulti-page scraper that extracts information from multiple pages given a single prompt and a list of sources.
    ScriptCreatorMultiGraphMulti-page scraper that generates a Python script for extracting information from multiple pages and sources.

    For each of these graphs there is the multi version. It allows to make calls of the LLM in parallel.

    It is possible to use different LLM through APIs, such as OpenAI, Groq, Azure, Gemini, MiniMax and more, or local models using Ollama.

    Remember to have Ollama installed and download the models using the ollama pull command, if you want to use local models.

    📖 Documentation

    Open In Colab

    The documentation for ScrapeGraphAI can be found here.

    🆚 Open Source vs Managed API

    ScrapeGraphAI comes in two flavours: this open-source library, which you run yourself, and the managed cloud API (used via the Python and JS/TS SDKs). This table explains the difference so you can pick the right one.

    Open Source (scrapegraphai)Managed API (scrapegraph-py / scrapegraph-js)
    What it isA Python library you run yourselfA hosted cloud service you call via SDK
    Where it runsYour own infrastructure (self-hosted)ScrapeGraphAI cloud
    LLMBring your own (OpenAI, Groq, Gemini, Azure, local via Ollama)Managed for you
    Browser / JS renderingYou configure it (Playwright)Managed (stealth, auto/fast/js modes)
    Proxies & anti-botYour responsibilityIncluded
    Scaling & maintenanceYour responsibilityFully managed
    Cost modelLLM tokens + your own infraPay-as-you-go credits
    AuthYour own LLM keysSGAI_API_KEY
    CapabilitiesGraph pipelines (SmartScraper, Search, Speech, ScriptCreator…)Scrape, Extract, Search, Crawl, Monitor, History
    Setup effortMore configurationMinimal — API key + one call
    LicenseMITSDK is MIT; the API service is paid

    Choose the open-source library if you want full control, on-prem/self-hosted data, local LLMs (Ollama), or fine-grained cost tuning — and you're happy to manage browsers, proxies and scaling yourself.

    Choose the managed API if you want zero infrastructure, managed JS rendering & anti-bot, built-in Crawl and scheduled Monitor jobs, and the fastest path to production — billed per credit.

    🏆 Sponsors

    NodeMaven

    Codes for ScrapeGraphAI users: SCRAPEGRAPH35 (35% off mobile and residential proxies), SCRAPEGRAPH40 (40% off ISP / static proxies).

    🤝 Contributing

    Feel free to contribute and join our Discord server to discuss with us improvements and give us suggestions!

    Please see the contributing guidelines.

    My Skills My Skills My Skills

    🔗 ScrapeGraph API & SDKs

    If you are looking for a quick solution to integrate ScrapeGraph in your system, check out our powerful API here!

    API Banner

    We offer SDKs in both Python and Node.js, making it easy to integrate into your projects. Check them out below:

    SDKLanguageGitHub Link
    Python SDKPythonscrapegraph-py
    Node.js SDKNode.jsscrapegraph-js

    The Official API Documentation can be found here.

    📈 Telemetry

    We collect anonymous usage metrics to enhance our package's quality and user experience. The data helps us prioritize improvements and ensure compatibility. If you wish to opt-out, set the environment variable SCRAPEGRAPHAI_TELEMETRY_ENABLED=false. For more information, please refer to the documentation here.

    ❤️ Contributors

    Contributors

    🎓 Citations

    If you have used our library for research purposes please quote us with the following reference:

      @misc{scrapegraph-ai,
        author = {Lorenzo Padoan, Marco Vinciguerra},
        title = {Scrapegraph-ai},
        year = {2024},
        url = {https://github.com/ScrapeGraphAI/Scrapegraph-ai},
        note = {A Python library for scraping leveraging large language models}
      }
    

    Authors

    Contact Info
    Marco VinciguerraLinkedin Badge
    Lorenzo PadoanLinkedin Badge

    📜 License

    ScrapeGraphAI is licensed under the MIT License. See the LICENSE file for more information.

    Acknowledgements

    • We would like to thank all the contributors to the project and the open-source community for their support.
    • ScrapeGraphAI is meant to be used for data exploration and research purposes only. We are not responsible for any misuse of the library.

    Made with ❤️ by ScrapeGraph AI

    Scarf tracking