LangChain tools for the MrScraper web-scraping API
Project description
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_serpmrscraper_fetch_htmlmrscraper_create_scrapermrscraper_rerun_ai_scrapermrscraper_bulk_rerun_ai_scrapermrscraper_rerun_manual_scrapermrscraper_bulk_rerun_manual_scrapermrscraper_get_all_resultsmrscraper_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.
Project details
Release history Release notifications | RSS feed
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 langchain_mrscraper-0.2.3.tar.gz.
File metadata
- Download URL: langchain_mrscraper-0.2.3.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf8d3fa1006b29be3a7e2efa86270ec891252059cdb09ebf18a3cdd9488cf485
|
|
| MD5 |
5a6c7d92f8d5f5c1c3ee10009cb1d84b
|
|
| BLAKE2b-256 |
348e853f195f20ab8a50c8faefe1cf9cd25862a2e046425bc2e111e7e721f5a5
|
File details
Details for the file langchain_mrscraper-0.2.3-py3-none-any.whl.
File metadata
- Download URL: langchain_mrscraper-0.2.3-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09558eae6a48badbc3c21ebcb1034a9eaa569588d33decd72a00cbbb66f3b713
|
|
| MD5 |
314c7138df3d7fdeb4616f1006d8be8d
|
|
| BLAKE2b-256 |
258f83761fed21baa4cfa5e5e3ae4b29a8b61c652f85ca46cd82743b44f136e1
|