minicrawl-py
Python client for minicrawl, the self-hosted, Firecrawl-compatible scraping API, with LangChain and LlamaIndex integrations.
You need a running minicrawl server (see the quick start) and its API key.
pip install minicrawl-py # client only
pip install "minicrawl-py[langchain]" # + LangChain loader
pip install "minicrawl-py[llama-index]" # + LlamaIndex reader
It installs as minicrawl-py and imports as minicrawl: from minicrawl import Minicrawl.
Configure it with arguments, or with the environment:
export MINICRAWL_API_URL=http://localhost:3002
export MINICRAWL_API_KEY=your-minicrawl-api-key
Client
from minicrawl import Minicrawl, MinicrawlError
mc = Minicrawl() # or Minicrawl(api_url="http://localhost:3002", api_key="...")
page = mc.scrape("https://example.com")
print(page["markdown"], page["metadata"]["title"])
links = mc.map("https://docs.python.org/3/", search="asyncio", limit=20)
results = mc.search("self-hosted web scraping", limit=5, scrapeOptions={"formats": ["markdown"]})
pages = mc.crawl("https://books.toscrape.com", limit=20, crawlEntireDomain=True)
# Stream pages while a crawl runs
for doc in mc.iter_crawl(mc.start_crawl("https://books.toscrape.com", limit=50)):
print(doc["metadata"]["url"])
# AI extraction (needs ANTHROPIC_API_KEY on the server)
data = mc.extract(["https://books.toscrape.com/*"], prompt="List book titles and prices")
try:
mc.scrape("https://example.com/file.zip")
except MinicrawlError as e:
print(e.status, e.code) # 422 UNSUPPORTED_FILE
Keyword arguments are passed through as the API's request fields, so every option in the API reference works: formats, actions, jsonOptions, includePaths, proxy, …
LangChain
from minicrawl.langchain import MinicrawlLoader
docs = MinicrawlLoader("https://example.com").load() # one page
docs = MinicrawlLoader("https://docs.example.com", mode="crawl",
params={"limit": 50, "includePaths": ["^/guide/"]}).load() # a site
docs = MinicrawlLoader("vector databases comparison", mode="search",
params={"limit": 5}).load() # web search
| Mode | Documents |
|---|---|
scrape |
One document for the page (also PDFs, Office files, images) |
crawl |
One per crawled page (lazy_load() streams them while the crawl runs) |
map |
One per URL on the site (page_content is the URL) |
search |
One per search result, with the page's markdown |
metadata holds the page metadata (title, url, statusCode, …) plus source.
LlamaIndex
from llama_index.core import VectorStoreIndex
from minicrawl.llama_index import MinicrawlReader
reader = MinicrawlReader()
documents = reader.load_data(url="https://docs.example.com", mode="crawl", params={"limit": 50})
index = VectorStoreIndex.from_documents(documents)
load_data(url=..., urls=[...], query=..., mode="scrape"|"crawl"|"map"|"search", params={...})
Development
pip install -e ".[dev]"
pytest # starts a real minicrawl server (needs Node.js and the repo's npm install)
License: AGPL-3.0, like minicrawl.
Metadata
Release files for minicrawl-py 1.0.0
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 | Actions |
|---|---|---|---|---|
| minicrawl_py-1.0.0.tar.gz | 20.3 kB | Without provenance | Details for minicrawl_py-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| minicrawl_py-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for minicrawl_py-1.0.0-py3-none-any.whl |
Total release size: 40.7 kB
Release files / minicrawl_py-1.0.0.tar.gz
| Download URL | minicrawl_py-1.0.0.tar.gz |
|---|---|
| Size | 20.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3f4e9a659ae11480a92576d826f8871bda5fa6d478b761bd48489bddf4a455d
|
|
BLAKE2b-256 checksum How to use checksums |
e2e246b09f440e39044c6165da518cdcf2446a7cd69e777e8347b89b9d091144
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / minicrawl_py-1.0.0-py3-none-any.whl
| Download URL | minicrawl_py-1.0.0-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8a3d6d0189181f3468489cc66a47e099bdc0c1b388578f135a125a975d6f2c7
|
|
BLAKE2b-256 checksum How to use checksums |
f8e3bb5f55465dbd954e6d0d39916bbd83bcd5207540ef1cc499e529451b370c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for minicrawl-py 1.0.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.