Skip to main content

A web scraping library based on LangChain which uses LLM and direct graph logic to create scraping pipelines.

Project description

🕷️ ScrapeGraphAI: You Only Scrape Once

Downloads linting: pylint Pylint License: MIT

ScrapeGraphAI is a web scraping python library based on LangChain which uses LLM and direct graph logic to create scraping pipelines for websites and documents. Just say which information you want to extract and the library will do it for you!

Scrapegraph-ai Logo

🚀 Quick install

The reference page for Scrapegraph-ai is avaible on the official page of pypy: pypi.

pip install scrapegraphai

🔍 Demo

Official streamlit demo:

My Skills

Try it directly on the web using Google Colab:

Open In Colab

Follow the procedure on the following link to setup your OpenAI API key: link.

📖 Documentation

The documentation for ScrapeGraphAI can be found here.

Check out also the docusaurus documentation.

💻 Usage

Case 1: Extracting information using a prompt

You can use the SmartScraper class to extract information from a website using a prompt.

The SmartScraper class is a direct graph implementation that uses the most common nodes present in a web scraping pipeline. For more information, please see the documentation.

from scrapegraphai.graphs import SmartScraper

OPENAI_API_KEY = "YOUR_API_KEY"

llm_config = {
    "api_key": OPENAI_API_KEY,
    "model_name": "gpt-3.5-turbo",
}

smart_scraper = SmartScraper("List me all the titles and project descriptions",
                             "https://perinim.github.io/projects/", llm_config)

answer = smart_scraper.run()
print(answer)

The output will be a dictionary with the extracted information, for example:

{
    'titles': [
        'Rotary Pendulum RL'
        ],
    'descriptions': [
        'Open Source project aimed at controlling a real life rotary pendulum using RL algorithms'
        ]
}

🤝 Contributing

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

For more information, please see the contributing guidelines.

My Skills My Skills

❤️ Contributors

Contributors

🎓 Citations

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

  @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 data from graphs}
  }

Authors

Authors Logos

Contact Info
Marco Vinciguerra Linkedin Badge
Marco Perini 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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scrapegraphai-0.0.9.tar.gz (52.9 kB view hashes)

Uploaded Source

Built Distribution

scrapegraphai-0.0.9-py3-none-any.whl (36.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page