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

ScrapeGraphAI is a web scraping python library based on LangChain which uses LLM and direct graph logic to create scraping pipelines. 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

Try out ScrapeGraphAI in your browser:

Open In Colab

📖 Documentation

The documentation for ScrapeGraphAI can be found here. Behind this there is also the docusaurus documentation here).

Setup the api keys

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

💻 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

Scrapegraph-ai is MIT LICENSED.

Contributions are welcome! Please check out the todos below, and feel free to open a pull request.

For more information, please see the contributing guidelines.

Join our Discord server to discuss with us improvements and give us suggestions!

Join Discord Server

Contributors

Contributors

Authors

Authors Logos

📜 License

ScrapeGraphAI is licensed under the Apache 2.0 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.

Thanks to:

  • nicolapiazzalunga for having inspired us to the functions: scrapegraph/convert_to_json.py and scrapegraph/convert_to_csv.py

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.4.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrapegraphai-0.0.4-py3-none-any.whl (31.5 kB view details)

Uploaded Python 3

File details

Details for the file scrapegraphai-0.0.4.tar.gz.

File metadata

  • Download URL: scrapegraphai-0.0.4.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.7 Windows/10

File hashes

Hashes for scrapegraphai-0.0.4.tar.gz
Algorithm Hash digest
SHA256 1c3e4fe6082cecce978ab46c3d1b0e884cf79d1ba6c7600900ba1bf91ec2b4b8
MD5 28bdccfa1cb01ddb12fb89a7ae479c40
BLAKE2b-256 b51c77ec738af1b9ae3968c6d138916f6c07eb7f231de8f8f88c4168c89859b5

See more details on using hashes here.

File details

Details for the file scrapegraphai-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: scrapegraphai-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 31.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.7 Windows/10

File hashes

Hashes for scrapegraphai-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a0d96e7eb676f97448ba9605d1c455051f664a411cec84da869d4ce6f3f36a94
MD5 cac6befcd47aa41a208fb22c5f9ddba8
BLAKE2b-256 7063cfc759e652e9328318fa5ff92f35c2f3a91bfbe6a2b2ca841e256852bdf2

See more details on using hashes here.

Supported by

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