# π·οΈ ScrapeGraphAI: You Only Scrape Once
[English](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/README.md) | [δΈζ](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/docs/chinese.md) | [ζ₯ζ¬θͺ](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/docs/japanese.md)
| [νκ΅μ΄](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/docs/korean.md)
| [Π ΡΡΡΠΊΠΈΠΉ](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/docs/russian.md)
[![Downloads](https://img.shields.io/pepy/dt/scrapegraphai?style=for-the-badge)](https://pepy.tech/project/scrapegraphai)
[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen?style=for-the-badge)](https://github.com/pylint-dev/pylint)
[![Pylint](https://img.shields.io/github/actions/workflow/status/VinciGit00/Scrapegraph-ai/pylint.yml?label=Pylint&logo=github&style=for-the-badge)](https://github.com/VinciGit00/Scrapegraph-ai/actions/workflows/pylint.yml)
[![CodeQL](https://img.shields.io/github/actions/workflow/status/VinciGit00/Scrapegraph-ai/codeql.yml?label=CodeQL&logo=github&style=for-the-badge)](https://github.com/VinciGit00/Scrapegraph-ai/actions/workflows/codeql.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
[![](https://dcbadge.vercel.app/api/server/gkxQDAjfeX)](https://discord.gg/gkxQDAjfeX)
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!
<p align="center">
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/sgai-hero.png" alt="ScrapeGraphAI Hero" style="width: 100%;">
</p>
## π Quick install
The reference page for Scrapegraph-ai is available on the official page of PyPI: [pypi](https://pypi.org/project/scrapegraphai/).
```bash
pip install scrapegraphai
playwright install
```
**Note**: it is recommended to install the library in a virtual environment to avoid conflicts with other libraries π±
<details>
<summary><b>Optional Dependencies</b></summary>
Additional dependecies can be added while installing the library:
- <b>More Language Models</b>: additional language models are installed, such as Fireworks, Groq, Anthropic, Hugging Face, and Nvidia AI Endpoints.
This group allows you to use additional language models like Fireworks, Groq, Anthropic, Together AI, Hugging Face, and Nvidia AI Endpoints.
```bash
pip install scrapegraphai[other-language-models]
```
- <b>Semantic Options</b>: this group includes tools for advanced semantic processing, such as Graphviz.
```bash
pip install scrapegraphai[more-semantic-options]
```
- <b>Browsers Options</b>: this group includes additional browser management tools/services, such as Browserbase.
```bash
pip install scrapegraphai[more-browser-options]
```
</details>
## π» 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.
```python
import json
from scrapegraphai.graphs import SmartScraperGraph
# Define the configuration for the scraping pipeline
graph_config = {
"llm": {
"api_key": "YOUR_OPENAI_APIKEY",
"model": "openai/gpt-4o-mini",
},
"verbose": True,
"headless": False,
}
# Create the SmartScraperGraph instance
smart_scraper_graph = SmartScraperGraph(
prompt="Find some information about what does the company do, the name and a contact email.",
source="https://scrapegraphai.com/",
config=graph_config
)
# Run the pipeline
result = smart_scraper_graph.run()
print(json.dumps(result, indent=4))
```
The output will be a dictionary like the following:
```python
{
"company": "ScrapeGraphAI",
"name": "ScrapeGraphAI Extracting content from websites and local documents using LLM",
"contact_email": "contact@scrapegraphai.com"
}
```
There are other pipelines that can be used to extract information from multiple pages, generate Python scripts, or even generate audio files.
| Pipeline Name | Description |
|-------------------------|------------------------------------------------------------------------------------------------------------------|
| SmartScraperGraph | Single-page scraper that only needs a user prompt and an input source. |
| SearchGraph | Multi-page scraper that extracts information from the top n search results of a search engine. |
| SpeechGraph | Single-page scraper that extracts information from a website and generates an audio file. |
| ScriptCreatorGraph | Single-page scraper that extracts information from a website and generates a Python script. |
| SmartScraperMultiGraph | Multi-page scraper that extracts information from multiple pages given a single prompt and a list of sources. |
| ScriptCreatorMultiGraph | Multi-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** and **Gemini**, or local models using **Ollama**.
Remember to have [Ollama](https://ollama.com/) installed and download the models using the **ollama pull** command, if you want to use local models.
## π Demo
Official streamlit demo:
[![My Skills](https://skillicons.dev/icons?i=react)](https://scrapegraph-ai-web-dashboard.streamlit.app)
Try it directly on the web using Google Colab:
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1sEZBonBMGP44CtO6GQTwAlL0BGJXjtfd?usp=sharing)
## π Documentation
The documentation for ScrapeGraphAI can be found [here](https://scrapegraph-ai.readthedocs.io/en/latest/).
Check out also the Docusaurus [here](https://scrapegraph-doc.onrender.com/).
## π Sponsors
<div style="text-align: center;">
<a href="https://2ly.link/1zaXG">
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/browserbase_logo.png" alt="Browserbase" style="width: 10%;">
</a>
<a href="https://2ly.link/1zNiz">
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/serp_api_logo.png" alt="SerpAPI" style="width: 10%;">
</a>
<a href="https://2ly.link/1zNj1">
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/transparent_stat.png" alt="Stats" style="width: 15%;">
</a>
<a href="https://scrape.do">
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/scrapedo.png" alt="Stats" style="width: 11%;">
</a>
</div>
## π€ Contributing
Feel free to contribute and join our Discord server to discuss with us improvements and give us suggestions!
Please see the [contributing guidelines](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/CONTRIBUTING.md).
[![My Skills](https://skillicons.dev/icons?i=discord)](https://discord.gg/uJN7TYcpNa)
[![My Skills](https://skillicons.dev/icons?i=linkedin)](https://www.linkedin.com/company/scrapegraphai/)
[![My Skills](https://skillicons.dev/icons?i=twitter)](https://twitter.com/scrapegraphai)
## π 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](https://scrapegraph-ai.readthedocs.io/en/latest/scrapers/telemetry.html).
## β€οΈ Contributors
[![Contributors](https://contrib.rocks/image?repo=VinciGit00/Scrapegraph-ai)](https://github.com/VinciGit00/Scrapegraph-ai/graphs/contributors)
## π Citations
If you have used our library for research purposes please quote us with the following reference:
```text
@misc{scrapegraph-ai,
author = {Marco Perini, Lorenzo Padoan, Marco Vinciguerra},
title = {Scrapegraph-ai},
year = {2024},
url = {https://github.com/VinciGit00/Scrapegraph-ai},
note = {A Python library for scraping leveraging large language models}
}
```
## Authors
<p align="center">
<img src="https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/logo_authors.png" alt="Authors_logos">
</p>
| | Contact Info |
|--------------------|----------------------|
| Marco Vinciguerra | [![Linkedin Badge](https://img.shields.io/badge/-Linkedin-blue?style=flat&logo=Linkedin&logoColor=white)](https://www.linkedin.com/in/marco-vinciguerra-7ba365242/) |
| Marco Perini | [![Linkedin Badge](https://img.shields.io/badge/-Linkedin-blue?style=flat&logo=Linkedin&logoColor=white)](https://www.linkedin.com/in/perinim/) |
| Lorenzo Padoan | [![Linkedin Badge](https://img.shields.io/badge/-Linkedin-blue?style=flat&logo=Linkedin&logoColor=white)](https://www.linkedin.com/in/lorenzo-padoan-4521a2154/) |
## π License
ScrapeGraphAI is licensed under the MIT License. See the [LICENSE](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/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.
Raw data
{
"_id": null,
"home_page": null,
"name": "auk-scrapegraphai",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "ai, artificial intelligence, gpt, graph, langchain, llm, machine learning, natural language processing, nlp, openai, rag, scrapegraph, scrapegraphai, scraping, web scraping, web scraping library, web scraping tool, webscraping",
"author": null,
"author_email": "Aziz Ullah Khan <azizullah444@gmail.com>, Marco Vinciguerra <mvincig11@gmail.com>, Marco Perini <perinim.98@gmail.com>, Lorenzo Padoan <lorenzo.padoan977@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/2b/ab/0adde7b6c9d37acdaa9c1976b5e446988c218352a355db1c1055411c22e3/auk_scrapegraphai-1.26.0b19.tar.gz",
"platform": null,
"description": "\n# \ud83d\udd77\ufe0f ScrapeGraphAI: You Only Scrape Once\n[English](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/README.md) | [\u4e2d\u6587](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/docs/chinese.md) | [\u65e5\u672c\u8a9e](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/docs/japanese.md)\n| [\ud55c\uad6d\uc5b4](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/docs/korean.md)\n| [\u0420\u0443\u0441\u0441\u043a\u0438\u0439](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/docs/russian.md)\n\n\n[![Downloads](https://img.shields.io/pepy/dt/scrapegraphai?style=for-the-badge)](https://pepy.tech/project/scrapegraphai)\n[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen?style=for-the-badge)](https://github.com/pylint-dev/pylint)\n[![Pylint](https://img.shields.io/github/actions/workflow/status/VinciGit00/Scrapegraph-ai/pylint.yml?label=Pylint&logo=github&style=for-the-badge)](https://github.com/VinciGit00/Scrapegraph-ai/actions/workflows/pylint.yml)\n[![CodeQL](https://img.shields.io/github/actions/workflow/status/VinciGit00/Scrapegraph-ai/codeql.yml?label=CodeQL&logo=github&style=for-the-badge)](https://github.com/VinciGit00/Scrapegraph-ai/actions/workflows/codeql.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)\n[![](https://dcbadge.vercel.app/api/server/gkxQDAjfeX)](https://discord.gg/gkxQDAjfeX)\n\nScrapeGraphAI 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.).\n\nJust say which information you want to extract and the library will do it for you!\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/sgai-hero.png\" alt=\"ScrapeGraphAI Hero\" style=\"width: 100%;\">\n</p>\n\n## \ud83d\ude80 Quick install\n\nThe reference page for Scrapegraph-ai is available on the official page of PyPI: [pypi](https://pypi.org/project/scrapegraphai/).\n\n```bash\npip install scrapegraphai\n\nplaywright install\n```\n\n**Note**: it is recommended to install the library in a virtual environment to avoid conflicts with other libraries \ud83d\udc31\n\n<details>\n<summary><b>Optional Dependencies</b></summary>\nAdditional dependecies can be added while installing the library:\n\n- <b>More Language Models</b>: additional language models are installed, such as Fireworks, Groq, Anthropic, Hugging Face, and Nvidia AI Endpoints.\n\n This group allows you to use additional language models like Fireworks, Groq, Anthropic, Together AI, Hugging Face, and Nvidia AI Endpoints.\n ```bash\n pip install scrapegraphai[other-language-models]\n ```\n- <b>Semantic Options</b>: this group includes tools for advanced semantic processing, such as Graphviz.\n\n ```bash\n pip install scrapegraphai[more-semantic-options]\n ```\n\n- <b>Browsers Options</b>: this group includes additional browser management tools/services, such as Browserbase.\n\n ```bash\n pip install scrapegraphai[more-browser-options]\n ```\n\n</details>\n\n\n## \ud83d\udcbb Usage\nThere are multiple standard scraping pipelines that can be used to extract information from a website (or local file).\n\nThe most common one is the `SmartScraperGraph`, which extracts information from a single page given a user prompt and a source URL.\n\n\n```python\nimport json\nfrom scrapegraphai.graphs import SmartScraperGraph\n\n# Define the configuration for the scraping pipeline\ngraph_config = {\n \"llm\": {\n \"api_key\": \"YOUR_OPENAI_APIKEY\",\n \"model\": \"openai/gpt-4o-mini\",\n },\n \"verbose\": True,\n \"headless\": False,\n}\n\n# Create the SmartScraperGraph instance\nsmart_scraper_graph = SmartScraperGraph(\n prompt=\"Find some information about what does the company do, the name and a contact email.\",\n source=\"https://scrapegraphai.com/\",\n config=graph_config\n)\n\n# Run the pipeline\nresult = smart_scraper_graph.run()\nprint(json.dumps(result, indent=4))\n```\n\nThe output will be a dictionary like the following:\n\n```python\n{\n \"company\": \"ScrapeGraphAI\",\n \"name\": \"ScrapeGraphAI Extracting content from websites and local documents using LLM\",\n \"contact_email\": \"contact@scrapegraphai.com\"\n}\n```\nThere are other pipelines that can be used to extract information from multiple pages, generate Python scripts, or even generate audio files.\n\n| Pipeline Name | Description |\n|-------------------------|------------------------------------------------------------------------------------------------------------------|\n| SmartScraperGraph | Single-page scraper that only needs a user prompt and an input source. |\n| SearchGraph | Multi-page scraper that extracts information from the top n search results of a search engine. |\n| SpeechGraph | Single-page scraper that extracts information from a website and generates an audio file. |\n| ScriptCreatorGraph | Single-page scraper that extracts information from a website and generates a Python script. |\n| SmartScraperMultiGraph | Multi-page scraper that extracts information from multiple pages given a single prompt and a list of sources. |\n| ScriptCreatorMultiGraph | Multi-page scraper that generates a Python script for extracting information from multiple pages and sources. |\n\nFor each of these graphs there is the multi version. It allows to make calls of the LLM in parallel.\n\nIt is possible to use different LLM through APIs, such as **OpenAI**, **Groq**, **Azure** and **Gemini**, or local models using **Ollama**.\n\nRemember to have [Ollama](https://ollama.com/) installed and download the models using the **ollama pull** command, if you want to use local models.\n\n## \ud83d\udd0d Demo\nOfficial streamlit demo:\n\n[![My Skills](https://skillicons.dev/icons?i=react)](https://scrapegraph-ai-web-dashboard.streamlit.app)\n\nTry it directly on the web using Google Colab:\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1sEZBonBMGP44CtO6GQTwAlL0BGJXjtfd?usp=sharing)\n\n## \ud83d\udcd6 Documentation\n\nThe documentation for ScrapeGraphAI can be found [here](https://scrapegraph-ai.readthedocs.io/en/latest/).\n\nCheck out also the Docusaurus [here](https://scrapegraph-doc.onrender.com/).\n\n## \ud83c\udfc6 Sponsors\n<div style=\"text-align: center;\">\n <a href=\"https://2ly.link/1zaXG\">\n <img src=\"https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/browserbase_logo.png\" alt=\"Browserbase\" style=\"width: 10%;\">\n </a>\n <a href=\"https://2ly.link/1zNiz\">\n <img src=\"https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/serp_api_logo.png\" alt=\"SerpAPI\" style=\"width: 10%;\">\n </a>\n <a href=\"https://2ly.link/1zNj1\">\n <img src=\"https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/transparent_stat.png\" alt=\"Stats\" style=\"width: 15%;\">\n </a>\n <a href=\"https://scrape.do\">\n <img src=\"https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/scrapedo.png\" alt=\"Stats\" style=\"width: 11%;\">\n </a>\n</div>\n\n## \ud83e\udd1d Contributing\n\nFeel free to contribute and join our Discord server to discuss with us improvements and give us suggestions!\n\nPlease see the [contributing guidelines](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/CONTRIBUTING.md).\n\n[![My Skills](https://skillicons.dev/icons?i=discord)](https://discord.gg/uJN7TYcpNa)\n[![My Skills](https://skillicons.dev/icons?i=linkedin)](https://www.linkedin.com/company/scrapegraphai/)\n[![My Skills](https://skillicons.dev/icons?i=twitter)](https://twitter.com/scrapegraphai)\n\n## \ud83d\udcc8 Telemetry \nWe 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](https://scrapegraph-ai.readthedocs.io/en/latest/scrapers/telemetry.html).\n\n\n## \u2764\ufe0f Contributors\n[![Contributors](https://contrib.rocks/image?repo=VinciGit00/Scrapegraph-ai)](https://github.com/VinciGit00/Scrapegraph-ai/graphs/contributors)\n\n## \ud83c\udf93 Citations\nIf you have used our library for research purposes please quote us with the following reference:\n```text\n @misc{scrapegraph-ai,\n author = {Marco Perini, Lorenzo Padoan, Marco Vinciguerra},\n title = {Scrapegraph-ai},\n year = {2024},\n url = {https://github.com/VinciGit00/Scrapegraph-ai},\n note = {A Python library for scraping leveraging large language models}\n }\n```\n\n## Authors\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/VinciGit00/Scrapegraph-ai/main/docs/assets/logo_authors.png\" alt=\"Authors_logos\">\n</p>\n\n| | Contact Info |\n|--------------------|----------------------|\n| Marco Vinciguerra | [![Linkedin Badge](https://img.shields.io/badge/-Linkedin-blue?style=flat&logo=Linkedin&logoColor=white)](https://www.linkedin.com/in/marco-vinciguerra-7ba365242/) |\n| Marco Perini | [![Linkedin Badge](https://img.shields.io/badge/-Linkedin-blue?style=flat&logo=Linkedin&logoColor=white)](https://www.linkedin.com/in/perinim/) |\n| Lorenzo Padoan | [![Linkedin Badge](https://img.shields.io/badge/-Linkedin-blue?style=flat&logo=Linkedin&logoColor=white)](https://www.linkedin.com/in/lorenzo-padoan-4521a2154/) |\n\n## \ud83d\udcdc License\n\nScrapeGraphAI is licensed under the MIT License. See the [LICENSE](https://github.com/VinciGit00/Scrapegraph-ai/blob/main/LICENSE) file for more information.\n\n## Acknowledgements\n\n- We would like to thank all the contributors to the project and the open-source community for their support.\n- ScrapeGraphAI is meant to be used for data exploration and research purposes only. We are not responsible for any misuse of the library.\n",
"bugtrack_url": null,
"license": null,
"summary": "A web scraping library based on LangChain which uses LLM and direct graph logic to create scraping pipelines.",
"version": "1.26.0b19",
"project_urls": null,
"split_keywords": [
"ai",
" artificial intelligence",
" gpt",
" graph",
" langchain",
" llm",
" machine learning",
" natural language processing",
" nlp",
" openai",
" rag",
" scrapegraph",
" scrapegraphai",
" scraping",
" web scraping",
" web scraping library",
" web scraping tool",
" webscraping"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1ff5bcb9608ddbdae7f50dbec6b532b05e9ec870dfa65cc6b67719975d1d750a",
"md5": "80a98db7de3c0f94eb267d894d2ea2c9",
"sha256": "c8928f7fd784ef5225985dea644a29ba8cf5713ac5e87ee639865b5e2f604f69"
},
"downloads": -1,
"filename": "auk_scrapegraphai-1.26.0b19-py3-none-any.whl",
"has_sig": false,
"md5_digest": "80a98db7de3c0f94eb267d894d2ea2c9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 164005,
"upload_time": "2024-10-12T16:28:18",
"upload_time_iso_8601": "2024-10-12T16:28:18.238284Z",
"url": "https://files.pythonhosted.org/packages/1f/f5/bcb9608ddbdae7f50dbec6b532b05e9ec870dfa65cc6b67719975d1d750a/auk_scrapegraphai-1.26.0b19-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2bab0adde7b6c9d37acdaa9c1976b5e446988c218352a355db1c1055411c22e3",
"md5": "ad863a3ddfd1729b41409d9457c20e0a",
"sha256": "9bf36431256fb86fbd0846ebc3b8b2d8df87281b55017f10aebe4cb87da1ad0a"
},
"downloads": -1,
"filename": "auk_scrapegraphai-1.26.0b19.tar.gz",
"has_sig": false,
"md5_digest": "ad863a3ddfd1729b41409d9457c20e0a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 3491928,
"upload_time": "2024-10-12T16:28:28",
"upload_time_iso_8601": "2024-10-12T16:28:28.551426Z",
"url": "https://files.pythonhosted.org/packages/2b/ab/0adde7b6c9d37acdaa9c1976b5e446988c218352a355db1c1055411c22e3/auk_scrapegraphai-1.26.0b19.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-12 16:28:28",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "auk-scrapegraphai"
}