Skip to main content

langchain-scrapeit

ScrapeIt for LangChain: load web pages and whole sites as Documents, and give agents tools to scrape a page and search Google. ScrapeIt fetches each page through its proxies, renders JavaScript when the page needs it and gets past anti-bot protection.

Class What it does
ScrapeitLoader Document loader: URLs to Documents (markdown, text or HTML); mode="crawl" crawls a site.
ScrapeitScrapeTool Agent tool scrapeit_scrape: one URL in, the page as markdown out.
ScrapeitGoogleSearchTool Agent tool scrapeit_google_search: a query in, the parsed Google results page out (JSON).

Install

pip install -U langchain-scrapeit

Python 3.11+, langchain-core 1.x. 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 any class. The key is sent only in the x-api-key header to https://api.scrapeit.io; it is never part of a tool's repr, its serialized form or an error message.

Load pages

from langchain_scrapeit import ScrapeitLoader

loader = ScrapeitLoader(urls=["https://example.com"])
docs = loader.load()

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

params passes any Web Scraping API parameter:

loader = ScrapeitLoader(
    urls=["https://example.com/pricing"],
    output_format="text",  # "markdown" (default), "text" or "html"
    params={"jsRendering": True, "proxyType": "residential", "proxyCountry": "us"},
)

lazy_load(), aload() and alazy_load() work too; the async methods use 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:

loader = ScrapeitLoader(
    urls="https://example.com/blog/",
    mode="crawl",
    params={"maxDepth": 2, "limit": 50, "includePaths": ["/blog/*"]},
)
docs = loader.load()  # metadata: source, depth, status_code, credits, crawl_job_id

Agent tools

from langchain_scrapeit import ScrapeitGoogleSearchTool, ScrapeitScrapeTool

scrape = ScrapeitScrapeTool()
search = ScrapeitGoogleSearchTool()

scrape.invoke({"url": "https://example.com"})  # the page as markdown
results = search.invoke({"query": "best coffee maker", "country": "us", "language": "en"})
results["organic_results"][0]["link"]

Give them to any tool-calling agent (pip install langchain plus the integration of your chat model):

from langchain.agents import create_agent

agent = create_agent("openai:gpt-4.1-mini", tools=[scrape, search])
agent.invoke({"messages": [{"role": "user", "content": "What does example.com say about itself?"}]})

ScrapeitScrapeTool(params={...}) sets Web Scraping API parameters for every call, and output_format="text" returns plain text instead of markdown.

Errors

A failed request raises scrapeit.ScrapeitError from the loader and ToolException from a tool. Both carry the stable API error code, for example INSUFFICIENT_CREDITS, TARGET_BLOCKED or SCRAPE_TIMEOUT, and the correlation id to quote to support. Build a tool with handle_tool_error=True to hand the error text to the agent instead of raising. A missing key fails when a tool 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 loader leaves out a page whose answer was empty.

Credits

Every scrape, search 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 langchain-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 langchain-scrapeit 0.1.0
File Size Uploaded Provenance Actions
langchain_scrapeit-0.1.0.tar.gz 12.9 kB Without provenance Details for langchain_scrapeit-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 23.7 kB

Release files / langchain_scrapeit-0.1.0.tar.gz

Download URL langchain_scrapeit-0.1.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d106f55a17fa9b3d208eeb1f2e3412f4e1ba93927eed46748a47cf389f721fa4
BLAKE2b-256 checksum
How to use checksums
efecdd38eb4c01e5d3f5dbc164ce085d4d337fc19c276778ae929070b01d6e9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

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

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

Security for langchain-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