scrapegraph-ai

Python scraper based on AI

https://github.com/scrapegraphai/scrapegraph-ai

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    4 of 105 committers (3.8%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.5%) to scientific vocabulary

Keywords

ai ai-scraping automated-scraper crawler html-to-markdown llm markdown rag scraping scraping-python web-crawler web-crawlers web-scraping

Keywords from Contributors

agent optimism interactive scheduler transformer sequencers hacking webscraping research mcp-server
Last synced: 6 months ago · JSON representation ·

Repository

Python scraper based on AI

Basic Info
  • Host: GitHub
  • Owner: ScrapeGraphAI
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage: https://scrapegraphai.com
  • Size: 14 MB
Statistics
  • Stars: 21,188
  • Watchers: 133
  • Forks: 1,803
  • Open Issues: 13
  • Releases: 0
Topics
ai ai-scraping automated-scraper crawler html-to-markdown llm markdown rag scraping scraping-python web-crawler web-crawlers web-scraping
Created about 2 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing Funding License Code of conduct Citation Security

README.md

🚀 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

Downloads linting: pylint Pylint CodeQL License: MIT

VinciGit00%2FScrapegraph-ai | Trendshift

[ScrapeGraphAI](https://scrapegraphai.com) 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!

ScrapeGraphAI Hero

🚀 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: - API: Documentation - SDKs: Python, Node - LLM Frameworks: Langchain, Llama Index, Crew.ai, Agno, CamelAI - Low-code Frameworks: Pipedream, Bubble, Zapier, n8n, Dify, Toolhouse - MCP server: Link

🚀 Quick install

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

```bash 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.

```python from scrapegraphai.graphs import SmartScraperGraph

Define the configuration for the scraping pipeline

graphconfig = { "llm": { "model": "ollama/llama3.2", "modeltokens": 8192 }, "verbose": True, "headless": False, }

Create the SmartScraperGraph instance

smartscrapergraph = 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 = smartscrapergraph.run()

import json print(json.dumps(result, indent=4)) ```

[!NOTE] For OpenAI and other models you just need to change the llm config! python 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:

python { "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 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 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. Check out also the Docusaurus here.

🤝 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!

ScrapeGraph API Banner

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

| SDK | Language | GitHub Link | |-----------|----------|-----------------------------------------------------------------------------| | Python SDK | Python | scrapegraph-py | | Node.js SDK | Node.js | scrapegraph-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 SCRAPEGRAPHAITELEMETRYENABLED=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: text @misc{scrapegraph-ai, author = {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

| | Contact Info | |--------------------|----------------------| | Marco Vinciguerra | Linkedin Badge | | Lorenzo Padoan | Linkedin 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

Owner

  • Name: ScrapeGraphAI
  • Login: ScrapeGraphAI
  • Kind: organization
  • Location: United States of America

Citation (citation.cff)

cff-version: 0.0.1
message: "If you use Scrapegraph-ai in your research, please cite it using these metadata."
authors:
  - family-names: Perini
    given-names: Marco
  - family-names: Padoan
    given-names: Lorenzo
  - family-names: Vinciguerra
    given-names: Marco
title: Scrapegraph-ai
version: v0.0.10
date-released: 2024-1-10
url: https://github.com/VinciGit00/Scrapegraph-ai
license: MIT

GitHub Events

Total
  • Create event: 165
  • Commit comment event: 51
  • Issues event: 209
  • Release event: 104
  • Watch event: 5,570
  • Delete event: 56
  • Issue comment event: 817
  • Push event: 457
  • Pull request review comment event: 20
  • Pull request event: 211
  • Pull request review event: 50
  • Fork event: 573
Last Year
  • Create event: 165
  • Commit comment event: 51
  • Issues event: 209
  • Release event: 104
  • Watch event: 5,573
  • Delete event: 56
  • Issue comment event: 818
  • Push event: 457
  • Pull request review comment event: 20
  • Pull request event: 211
  • Pull request review event: 50
  • Fork event: 573

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 2,040
  • Total Committers: 105
  • Avg Commits per committer: 19.429
  • Development Distribution Score (DDS): 0.567
Past Year
  • Commits: 868
  • Committers: 55
  • Avg Commits per committer: 15.782
  • Development Distribution Score (DDS): 0.636
Top Committers
Name Email Commits
Marco Vinciguerra m****1@g****m 884
semantic-release-bot s****t@m****t 428
Marco Perini p****8@g****m 262
Federico Aguzzi 6****i 84
Matteo Vedovati m****7@g****m 53
Lorenzo Padoan l****7@g****m 41
codebeaver-ai[bot] 1****] 17
roryhaung r****1@g****m 16
Eric Page e****0@g****m 14
Lorenzo Paleari 1****i 13
Federico Minutoli f****i@r****t 11
Santabot123 p****m@g****m 10
ekinsenler e****r@g****m 10
Tejas Amol Hande 5****e 10
smith peng p****h@g****m 9
JGalego j****0@g****m 9
aziz-ullah-khan a****4@g****m 8
mayurdb m****1@g****m 8
SwapnilSonker s****2@g****m 6
DPende p****e@g****m 5
Shubham Kamboj s****j@s****i 5
Alok Saboo a****o@g****m 4
CodeBeaver i****o@c****i 4
Stefan Krawczyk s****n@d****o 4
Tom Robinson t****n@g****m 4
dependabot[bot] 4****] 4
Ikko Eltociear Ashimine e****r@g****m 4
ftoppi f****i@g****m 4
Lrd l****s@g****m 4
SchneeHertz 3****z 3
and 75 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 259
  • Total pull requests: 560
  • Average time to close issues: 21 days
  • Average time to close pull requests: 1 day
  • Total issue authors: 190
  • Total pull request authors: 74
  • Average comments per issue: 2.52
  • Average comments per pull request: 1.68
  • Merged pull requests: 457
  • Bot issues: 0
  • Bot pull requests: 44
Past Year
  • Issues: 155
  • Pull requests: 348
  • Average time to close issues: 19 days
  • Average time to close pull requests: 1 day
  • Issue authors: 124
  • Pull request authors: 47
  • Average comments per issue: 2.17
  • Average comments per pull request: 1.72
  • Merged pull requests: 286
  • Bot issues: 0
  • Bot pull requests: 42
Top Authors
Issue Authors
  • VinciGit00 (16)
  • anth0nyhak1m (6)
  • nyck33 (6)
  • f-aguzzi (5)
  • LorenzoPaleari (4)
  • Kilowhisky (4)
  • aleenprd (4)
  • silgon (4)
  • angelotc (3)
  • DenisMarasescu (3)
  • matheus-rossi (3)
  • tm-robinson (3)
  • rjbks (3)
  • lurenss (2)
  • davideuler (2)
Pull Request Authors
  • VinciGit00 (264)
  • codebeaver-ai[bot] (42)
  • f-aguzzi (35)
  • PeriniM (25)
  • LorenzoPaleari (18)
  • aziz-ullah-khan (12)
  • vedovati-matteo (12)
  • ekinsenler (9)
  • shenghongtw (7)
  • goasleep (7)
  • SwapnilSonker (6)
  • tm-robinson (6)
  • SamuelYiuSY (4)
  • AmosDinh (4)
  • aflansburg (4)
Top Labels
Issue Labels
bug (32) released on @dev (11) feature request (9) question (9) enhancement (6) stale (5) documentation (2) refactor (1) dependencies (1)
Pull Request Labels
released on @stable (206) released on @dev (193) tests (49) size:M (29) size:L (28) bug (24) size:XS (18) lgtm (18) size:XL (16) dependencies (15) enhancement (13) size:S (11) documentation (10) size:XXL (8) refactor (7) typo (7)

Packages

  • Total packages: 2
  • Total downloads: unknown
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 0
    (may contain duplicates)
  • Total versions: 858
proxy.golang.org: github.com/scrapegraphai/scrapegraph-ai
  • Versions: 429
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/ScrapeGraphAI/Scrapegraph-ai
  • Versions: 429
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • Requests ==2.31.0
  • beautifulsoup4 ==4.12.3
  • langchain ==0.1.4
  • langchain_core ==0.1.16
  • langchain_openai ==0.0.5
  • python-dotenv ==1.0.1
requirements-dev.txt pypi
  • pytest ==8.0.0 development
  • sphinx ==7.1.2 development
  • sphinx-rtd-theme ==2.0.0 development
  • twine ==4.0.2 development
  • wheel ==0.42.0 development
.github/workflows/codeql.yml actions
  • actions/checkout v4 composite
  • github/codeql-action/init v3 composite
.github/workflows/dependency-review.yml actions
  • actions/checkout v4 composite
  • actions/dependency-review-action v4 composite
.github/workflows/pylint.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v5 composite
poetry.lock pypi
  • 143 dependencies
pyproject.toml pypi
  • pytest 8.0.0 develop
  • sphinx 7.1.2 docs
  • sphinx-rtd-theme 2.0.0 docs
  • beautifulsoup4 4.12.3
  • faiss-cpu 1.7.4
  • graphviz 0.20.1
  • html2text 2020.1.16
  • langchain 0.1.6
  • langchain_community 0.0.19
  • langchain_core 0.1.22
  • langchain_openai 0.0.5
  • pandas 2.0.3
  • python >3.9,<3.9.7 || >3.9.7,<3.12
  • python-dotenv 1.0.1
  • tiktoken >=0.5.2,<0.6.0
  • tqdm 4.66.1
  • trulens_eval 0.23.0