Universal AI-Powered Web Scraper Library
Project description
QwlCrapstar: Universal AI-Powered Web Scraper
QwlCrapstar is a robust, AI-driven web scraping library designed for structured data extraction from any website. By leveraging Large Language Models (LLMs), it understands the semantic context of web pages, making it resilient to layout changes and capable of extracting complex data with natural language instructions.
Key Features
- Semantic Extraction: Targeted data extraction based on meaning rather than brittle CSS selectors or XPaths.
- Self-Healing Architecture: Automatically adapts to changes in website structure without requiring code updates.
- Universal LLM Support: Native integration with OpenAI, Anthropic, Groq, DeepSeek, and local models via Ollama.
- Advanced Browser Automation: Built-in Playwright engine with human-like interaction patterns and anti-bot mitigation.
- Schema-Driven: Define extraction targets using simple dictionaries or pre-built industry schemas (e.g., E-commerce, Jobs, Real Estate).
- Privacy & Control: All credentials remain local; users provide their own API keys or use local models for full data sovereignty.
Installation
pip install qwlcrapstar
playwright install chromium
Configuration
QwlCrapstar supports multiple LLM providers. To use a specific provider, ensure the corresponding environment variable is set.
| Provider | Environment Variable | Model (Default) |
|---|---|---|
| Groq | GROQ_API_KEY |
llama3-70b-8192 |
| OpenAI | OPENAI_API_KEY |
gpt-4o |
| Anthropic | ANTHROPIC_API_KEY |
claude-3-5-sonnet |
| DeepSeek | DEEPSEEK_API_KEY |
deepseek-chat |
| Ollama | N/A (Local) | llama3 |
Initialization Example
from qwl_crapstar import QwlCrapstar
# Using Groq (Default)
scraper = QwlCrapstar(llm_provider="groq")
# Using local Ollama
scraper = QwlCrapstar(use_local_llm=True)
Usage Guide
1. Defining Schemas
You can define what you want to extract using a simple dictionary where the key is the field name and the value is a description for the LLM.
# Custom Schema
schema = {
"product_name": "The full name of the product",
"price_usd": "Price of the product in USD",
"availability": "Boolean indicating if the item is in stock"
}
2. Using Pre-built Schemas
QwlCrapstar provides standard schemas for common use cases:
from qwl_crapstar import PrebuiltSchemas
job_schema = PrebuiltSchemas.job_posting()
product_schema = PrebuiltSchemas.ecommerce_product()
real_estate_schema = PrebuiltSchemas.real_estate_listing()
3. Extracting Data
Execute a scrape by providing a URL, a prompt, and a schema.
import asyncio
from qwl_crapstar import QwlCrapstar
async def main():
scraper = QwlCrapstar(llm_provider="groq")
results = await scraper.scrape(
url="https://news.ycombinator.com",
prompt="Extract the top 5 stories ranking by points",
schema={
"title": "Story headline",
"points": "Number of points",
"link": "URL of the story"
}
)
for item in results:
print(item)
if __name__ == "__main__":
asyncio.run(main())
Data Export
Easily save your results in standard formats:
scraper.export_json(results, "data.json")
scraper.export_csv(results, "data.csv")
scraper.send_webhook("https://api.example.com/webhook", results)
License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qwlcrapstar-0.1.1.tar.gz.
File metadata
- Download URL: qwlcrapstar-0.1.1.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20d7bf2db25054588973e8301aad6b5b342ba948bb0bd03f0cffa2d73fc4641f
|
|
| MD5 |
0fc3bec68d0922bf69e35f47b24affc6
|
|
| BLAKE2b-256 |
42cd7f6fc48c8389d112b3ec6ccfc4087f6bb0a64e4c56b99fcd96a7283d0086
|
Provenance
The following attestation bundles were made for qwlcrapstar-0.1.1.tar.gz:
Publisher:
publish.yml on Ranzim/QwlCrapStar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qwlcrapstar-0.1.1.tar.gz -
Subject digest:
20d7bf2db25054588973e8301aad6b5b342ba948bb0bd03f0cffa2d73fc4641f - Sigstore transparency entry: 886383393
- Sigstore integration time:
-
Permalink:
Ranzim/QwlCrapStar@cd0f1d3f2af5ea943aa48347a8e1bc998c2bf2ce -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Ranzim
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cd0f1d3f2af5ea943aa48347a8e1bc998c2bf2ce -
Trigger Event:
release
-
Statement type:
File details
Details for the file qwlcrapstar-0.1.1-py3-none-any.whl.
File metadata
- Download URL: qwlcrapstar-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02a3229fc795928b5ae4907c824f8ff05d21b1584ec2175d14ab9850bcb4bef3
|
|
| MD5 |
b1cf6e370a8aa531532df169d365a61d
|
|
| BLAKE2b-256 |
2f7d3e28bdf3289e62599caf76cfce640997fdd83af6c14f03c1c031dd70e41d
|
Provenance
The following attestation bundles were made for qwlcrapstar-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Ranzim/QwlCrapStar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qwlcrapstar-0.1.1-py3-none-any.whl -
Subject digest:
02a3229fc795928b5ae4907c824f8ff05d21b1584ec2175d14ab9850bcb4bef3 - Sigstore transparency entry: 886383446
- Sigstore integration time:
-
Permalink:
Ranzim/QwlCrapStar@cd0f1d3f2af5ea943aa48347a8e1bc998c2bf2ce -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Ranzim
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cd0f1d3f2af5ea943aa48347a8e1bc998c2bf2ce -
Trigger Event:
release
-
Statement type: