api_url,
并换成 ZapFetch API Key。
快速开始
快速开始:Python
用 Firecrawl 官方 Python SDK 调用 ZapFetch。
Firecrawl Python SDK 只需改两处就能对接 ZapFetch:替换
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
用 Firecrawl 官方 Python SDK 调用 ZapFetch。
api_url,
并换成 ZapFetch API Key。
pip install firecrawl-py
from firecrawl import FirecrawlApp
app = FirecrawlApp(
api_key="YOUR_ZAPFETCH_API_KEY",
api_url="https://api.zapfetch.com",
)
result = app.scrape_url(
"https://example.com",
params={"formats": ["markdown"]},
)
print(result["markdown"])
# 阻塞式助手——等 crawl 跑完并返回所有页面。
job = app.crawl_url(
"https://docs.example.com",
params={"limit": 50},
wait_until_done=True,
)
for page in job["data"]:
print(page["metadata"]["sourceURL"])
schema = {
"type": "object",
"properties": {
"stories": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {"type": "string"},
"points": {"type": "integer"},
"author": {"type": "string"},
},
},
},
},
}
data = app.extract(
urls=["https://news.ycombinator.com"],
params={
"prompt": "Top 5 stories with points and author.",
"schema": schema,
},
)
print(data)