SpiderAI
A Python library for extracting structured data from web pages using AI. This library uses Google's Gemini AI to intelligently extract and format data according to your specified schema.
Features
- AI-powered content analysis using Google's Gemini AI
- Flexible schema definition for structured data extraction
- Automatic handling of web page fetching and parsing
- Supports both single objects and arrays of objects
Installation
pip install spiderai
Quick Start
-
First, get your Gemini AI API key from Google AI Studio
-
Create a
.envfile in your project root and add your API key:
GEMINI_API_KEY=your_api_key_here
- Use the library in your code:
from spiderai import WebDataExtractor
import os
from dotenv import load_dotenv
# Load API key from .env file
load_dotenv()
gemini_api_key = os.getenv("GEMINI_API_KEY")
# Create the extractor
extractor = WebDataExtractor(api_key=gemini_api_key)
# URL to extract data from
url = "https://yoururl.com"
# Define your schema
schema = {
"key1": "string",
"key2": "float",
"key3": "string"
}
# Extract the data
result = extractor.extract(url, schema)
# Use the extracted data
print("Product Name:", result["key1"])
print("Price:", result["key2"])
print("Description:", result["key3"])
Schema Definition
The schema is a dictionary where:
- Keys are the field names you want to extract
- Values are the expected data types ("string", "float", "integer", "boolean", "number", None)
Example schema:
# Product schema
schema = {
"name": "string",
"price": "float",
"rating": "float",
"review_count": "integer"
}
# Array of objects
schema = [
{
"name": "string",
"price": "float"
}
]
Requirements
- Python 3.10 or higher
- Google Gemini AI API key
- Internet connection for web scraping and AI processing
License
This project is licensed under MIT License
Contact
Feel free to contribute to the project by opening issues or suggesting improvements. For any queries, you can reach me at abhinavcv007@gmail.com
Metadata
Release files for spiderai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spiderai-0.1.0.tar.gz | 5.4 kB | Without provenance | Details for spiderai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spiderai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for spiderai-0.1.0-py3-none-any.whl |
Total release size: 10.8 kB
Release files / spiderai-0.1.0.tar.gz
| Download URL | spiderai-0.1.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
879352762f40c89bfbde486c62aaa4a54ec1afac636c9f73df766ca2f0d72dea
|
|
BLAKE2b-256 checksum How to use checksums |
0abdadc92320ffb9a43dab9fdc6ec67706ce33902719f99516f52424114f48b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.15
|
Release files / spiderai-0.1.0-py3-none-any.whl
| Download URL | spiderai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2daeeb80005e11081e84ff651b7f3e8f22f3db583518fb90431da367a8346310
|
|
BLAKE2b-256 checksum How to use checksums |
cac9aa44c64f2d374f8abad7fdf518f7e57a17d917f3c41480b5ac8c39a23fda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.15
|
Security for spiderai 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.