cognee-community-tasks-scrapegraph
Custom cognee tasks for scraping web content using ScrapeGraphAI.
Overview
This package provides two async tasks:
scrape_urls– scrape a list of URLs with a natural language prompt and return structured results.scrape_and_add– scrape URLs and ingest the content directly into a cognee dataset.
Installation
uv pip install cognee-community-tasks-scrapegraph
Or install locally with all dependencies:
cd packages/task/scrapegraph_tasks
uv sync --all-extras
# OR
poetry install
Requirements
You need two API keys:
| Variable | Description |
|---|---|
LLM_API_KEY |
OpenAI (or other LLM provider) API key used by cognee |
SGAI_API_KEY |
ScrapeGraphAI API key |
Set them in your environment or in a .env file:
export LLM_API_KEY="sk-..."
export SGAI_API_KEY="sgai-..."
Usage
Scrape only
import asyncio
from cognee_community_tasks_scrapegraph import scrape_urls
results = asyncio.run(
scrape_urls(
urls=["https://cognee.ai", "https://docs.cognee.ai"],
user_prompt="Extract the main content, title, and key information from this page",
)
)
for item in results:
print(item["url"], item["content"])
Scrape and add to cognee
import asyncio
from cognee_community_tasks_scrapegraph import scrape_and_add
asyncio.run(
scrape_and_add(
urls=["https://cognee.ai"],
user_prompt="Extract the main content and key information",
dataset_name="web_scrape",
)
)
Run the example
cd packages/task/scrapegraph_tasks
uv run python examples/example.py
# OR
poetry run python examples/example.py
API Reference
scrape_urls
async def scrape_urls(
urls: List[str],
user_prompt: str = "Extract the main content, title, and key information from this page",
api_key: Optional[str] = None,
) -> List[dict]
Returns a list of dicts:
[
{"url": "https://example.com", "content": {...}}, # success
{"url": "https://bad.invalid", "content": "", "error": "..."}, # failure
]
scrape_and_add
async def scrape_and_add(
urls: List[str],
user_prompt: str = "Extract the main content, title, and key information from this page",
api_key: Optional[str] = None,
dataset_name: str = "scrapegraph",
) -> Any
Scrapes all URLs, combines the successful results into a single text document, calls cognee.add, and then cognee.cognify. Returns the cognify result.
Metadata
Release files for cognee-community-tasks-scrapegraph 0.1.1
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 | |
|---|---|---|---|---|
| cognee_community_tasks_scrapegraph-0.1.1.tar.gz | 341.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cognee_community_tasks_scrapegraph-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 344.6 kB
Release files / cognee_community_tasks_scrapegraph-0.1.1.tar.gz
| Download URL | cognee_community_tasks_scrapegraph-0.1.1.tar.gz |
|---|---|
| Size | 341.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e90e67c7ed5545fc39c4897fa7fda7ca3a484c2c1ad962db59dbc3a157bb3cf
|
|
BLAKE2b-256 checksum How to use checksums |
78e2811dd2e43ee378d99390f8c28854da45ce5b62636c3f16085588fa33e166
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.11.13 Darwin/24.1.0
|
Release files / cognee_community_tasks_scrapegraph-0.1.1-py3-none-any.whl
| Download URL | cognee_community_tasks_scrapegraph-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
99dc74db3b8e7b951b980bfc05ad3f948db1e4deb76f2b9992b46d150a07b320
|
|
BLAKE2b-256 checksum How to use checksums |
54e91a90f5a84c614efb0e16f830c8e0732a50e01541dc9a409f4c1e0e832679
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.11.13 Darwin/24.1.0
|
Security for cognee-community-tasks-scrapegraph 0.1.1
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.