Skip to main content

langchain-mrscraper

LangChain integration package for the MrScraper SDK.

This package exposes MrScraper capabilities as LangChain tools so agents can:

  • Fetch rendered HTML from protected websites
  • Scrape Google SERP (search results) synchronously
  • Create AI scrapers from natural-language prompts
  • Rerun AI/manual scrapers (single and bulk)
  • List and fetch scraping results

Installation

pip install -U langchain-mrscraper

or:

uv add langchain-mrscraper

mrscraper-sdk is installed automatically as a dependency, so users do not need to install it separately.

Quick start

import os
from langchain_mrscraper import MrScraperToolkit

os.environ["MRSCRAPER_API_TOKEN"] = "your-token"

tools = MrScraperToolkit().get_tools()

Use with an agent

from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
from langchain_mrscraper import MrScraperToolkit

tools = MrScraperToolkit(token="your-token").get_tools()
agent = create_react_agent(ChatOpenAI(model="gpt-4o-mini"), tools)

Available tools

  • mrscraper_google_serp
  • mrscraper_fetch_html
  • mrscraper_create_scraper
  • mrscraper_rerun_ai_scraper
  • mrscraper_bulk_rerun_ai_scraper
  • mrscraper_rerun_manual_scraper
  • mrscraper_bulk_rerun_manual_scraper
  • mrscraper_get_all_results
  • mrscraper_get_result_by_id

API styles

You can initialize via:

  • MrScraperToolkit(...).get_tools() (recommended)
  • load_mrscraper_tools(...) convenience function
  • per-tool constructors with token="..."
  • environment variables MRSCRAPER_API_TOKEN

Tools vs. loaders

This integration is intentionally tools-first. MrScraper endpoints are action-oriented (fetch, create, rerun, list, retrieve) and best represented as BaseTool methods that agents can call explicitly.

A document loader abstraction is usually better when the primary job is deterministic "URL -> documents" ingestion into vector stores. MrScraper can support that in a separate package later, but this package should remain focused on agent tools.

Compliance & Legal Risk

WARNING Scraping login-protected pages carries serious legal and compliance risks. Many websites explicitly prohibit automated access in their Terms of Service, and bypassing authentication to scrape content may expose you to legal action including lawsuits, account termination, and financial penalties. By proceeding on scraping login-protected pages, you confirm that you have read and understood the target website's Terms of Service, and you fully accept all legal, financial, and ethical responsibility for your actions.

Release files for langchain-mrscraper 0.2.3

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-mrscraper 0.2.3
File Size Uploaded
langchain_mrscraper-0.2.3.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-mrscraper 0.2.3
File Interpreter ABI Platform
langchain_mrscraper-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 16.4 kB

Release files / langchain_mrscraper-0.2.3.tar.gz

Download URL langchain_mrscraper-0.2.3.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bf8d3fa1006b29be3a7e2efa86270ec891252059cdb09ebf18a3cdd9488cf485
BLAKE2b-256 checksum
How to use checksums
348e853f195f20ab8a50c8faefe1cf9cd25862a2e046425bc2e111e7e721f5a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / langchain_mrscraper-0.2.3-py3-none-any.whl

Download URL langchain_mrscraper-0.2.3-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09558eae6a48badbc3c21ebcb1034a9eaa569588d33decd72a00cbbb66f3b713
BLAKE2b-256 checksum
How to use checksums
258f83761fed21baa4cfa5e5e3ae4b29a8b61c652f85ca46cd82743b44f136e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.1

2 release files

0.1.0

2 release files

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