Skip to main content

LlamaIndex Readers Integration: ScrapeIt

ScrapeitWebReader loads web pages and whole sites into LlamaIndex Documents with ScrapeIt, a web scraping API: each page is fetched through ScrapeIt's proxies, rendered in a browser when it needs JavaScript and got past anti-bot protection, then returned as markdown, text or HTML.

Install

pip install llama-index-readers-scrapeit

Python 3.11+, llama-index-core 0.14. Built on the official scrapeit-sdk.

Authentication

Create an API key in the ScrapeIt dashboard under Workspace → API Keys (scope scrape:web; add scrapers:run and scrapers:read for crawl mode) and set it in the environment:

export SCRAPEIT_API_KEY="YOUR_SCRAPEIT_API_KEY"

Or pass api_key="..." to the reader. The key is sent only in the x-api-key header to https://api.scrapeit.io and is never part of the serialized reader (to_dict(), to_json()).

Usage

from llama_index.readers.scrapeit import ScrapeitWebReader

reader = ScrapeitWebReader()
documents = reader.load_data(urls=["https://example.com"])

print(documents[0].text)      # "Example Domain ..."
print(documents[0].metadata)  # {"url": "https://example.com", "request_id": "...", "status_code": 200, "credits": 4}

Build an index from the pages:

from llama_index.core import VectorStoreIndex

index = VectorStoreIndex.from_documents(documents)
answer = index.as_query_engine().query("What is this domain for?")

params passes any Web Scraping API parameter, and output_format picks the document text ("markdown", the default, "text" or "html"):

reader = ScrapeitWebReader(
    output_format="text",
    params={"jsRendering": True, "proxyType": "residential", "proxyCountry": "us"},
)

await reader.aload_data(urls=[...]) does the same on scrapeit.AsyncScrapeit.

Crawl a site

mode="crawl" starts one Website Crawler job from the URLs, waits for it to finish (crawl_timeout, 600 seconds by default) and returns a document per crawled page (pages that failed, were skipped or were blocked are left out). params takes the crawler options:

reader = ScrapeitWebReader(
    mode="crawl",
    params={"maxDepth": 2, "limit": 50, "includePaths": ["/blog/*"]},
)
documents = reader.load_data(urls=["https://example.com/blog/"])  # metadata: url, depth, status_code, credits, crawl_job_id

Errors

A failed request raises scrapeit.ScrapeitError. Branch on its stable code (for example INSUFFICIENT_CREDITS, TARGET_BLOCKED or SCRAPE_TIMEOUT) and quote its correlation_id to support. A missing key fails when the reader is created (MISSING_API_KEY).

A page is never replaced by an empty or a challenge text: a scrape that failed raises SCRAPE_FAILED (nothing charged, the reason in details["non_billable_failure_category"]), a site that answered with its anti-bot page raises TARGET_BLOCKED (charged: retry with jsRendering or residential proxies), and a crawl that ended failed raises CRAWL_FAILED with details["job_id"]. The reader leaves out a page whose answer was empty.

Credits

Every scraped and crawled page spends credits from your ScrapeIt plan, the same as a direct API call; failures on ScrapeIt's side are free. See billing and credits.

Metadata

Release files for llama-index-readers-scrapeit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-readers-scrapeit 0.1.0
File Size Uploaded Provenance Actions
llama_index_readers_scrapeit-0.1.0.tar.gz 9.3 kB Without provenance Details for llama_index_readers_scrapeit-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-readers-scrapeit 0.1.0
File Interpreter ABI Platform Actions
llama_index_readers_scrapeit-0.1.0-py3-none-any.whl Python 3 none any Details for llama_index_readers_scrapeit-0.1.0-py3-none-any.whl

Total release size: 16.5 kB

Release files / llama_index_readers_scrapeit-0.1.0.tar.gz

Download URL llama_index_readers_scrapeit-0.1.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2408049a24d51533640339675cbee9f85600e84e9942fbea18bfd52b3de5f914
BLAKE2b-256 checksum
How to use checksums
748126eea1a4ebf9922e7d2af619100fb09eb297e1e5cbd440fb3a6276ac04ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release files / llama_index_readers_scrapeit-0.1.0-py3-none-any.whl

Download URL llama_index_readers_scrapeit-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34390b284e711310479aa15bf4137e86fa9fd4ac0617994b14ce42c193ffd199
BLAKE2b-256 checksum
How to use checksums
acb41ac5242b5754f9879ea4d7e45a1faedaa6bd1f9abfb776b1aa5e772f2154
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Security for llama-index-readers-scrapeit 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page