Repository navigation
Sources fetch
BlueSkyXN edited this page May 4, 2026
·
2 revisions
事实来源:主仓
pr-88@a312645的_FETCH_HANDLERS注册表与registry/sources.py。21 个 fetch provider。
fetch 是 SouWen 的横切能力——21 个 provider 既能独立调用,也作为某些主域源的"跨域 fetch 方法"暴露(如 tavily.fetch / wayback.fetch)。
| Provider | 凭据 | 适合 |
|---|---|---|
| builtin | — | 默认起点,trafilatura 提取 |
| readability | — | Mozilla Readability + Markdown |
| newspaper | — | 新闻文章(带 author/date/keywords) |
| jina_reader | optional jina_api_key
|
任意 URL → Markdown |
| arxiv_fulltext | — | arXiv PDF → Markdown(PyMuPDF) |
| wayback | — | 抓历史快照 |
| deepwiki | — | GitHub 仓库 wiki/README |
| mcp | — | 通过外部 MCP fetch tool |
| crawl4ai | — | JS 重型,本地 Playwright |
| site_crawler | — | 多页递归抓取 |
| Provider | 凭据 | 特色 |
|---|---|---|
| cloudflare |
cloudflare_api_token + cloudflare_account_id
|
Browser Rendering,价格便宜 |
| firecrawl | firecrawl_api_key |
JS + 提取 + 含搜索 |
| tavily | tavily_api_key |
AI 增强,含搜索 |
| exa | exa_api_key |
语义抓取,含 find_similar |
| xcrawl | xcrawl_api_key |
国产 SERP+抓取一站式 |
| Provider | 凭据 | 特色 |
|---|---|---|
| scrapfly | scrapfly_api_key |
JS + AI 提取 + 反爬绕过 |
| scrapingbee | scrapingbee_api_key |
代理池 + JS + 反爬 |
| zenrows | zenrows_api_key |
代理池 + JS + 自动解析 |
| scraperapi | scraperapi_api_key |
大规模代理池 + JS |
| apify | apify_api_token |
平台化 Actor 爬虫 |
| diffbot | diffbot_api_token |
结构化文章/学术内容 |
flowchart TD
URL[URL] --> Type{页面类型}
Type -->|静态 HTML| Free1[builtin · readability · newspaper · jina_reader]
Type -->|JS 渲染| JS[crawl4ai · firecrawl · scrapfly · cloudflare]
Type -->|Cloudflare 防护| CF[cloudflare · scrapfly · scrapingbee · zenrows]
Type -->|学术 PDF| PDF[arxiv_fulltext · jina_reader]
Type -->|GitHub 仓库说明| GH[deepwiki]
Type -->|历史快照| WB[wayback]
Type -->|AI 摘要 + 抓取| AI[tavily · exa · perplexity]
Type -->|大规模批量| Batch[firecrawl · scraperapi · zenrows]
Type -->|多页站点| Spider[site_crawler]
| 源 | 主 domain | fetch 方法 |
|---|---|---|
| tavily | web | extract |
| firecrawl | web | scrape |
| exa | web | contents |
| wayback | archive | fetch |
| xcrawl | web | scrape |
-
抓什么都默认
firecrawl:比builtin贵 100 倍,简单页面差距小。 -
高频抓
wayback:IA 全局 ~15 req/min,会限流。 -
用
crawl4ai没装 Playwright:pip install souwen[crawl4ai] && playwright install chromium。 -
抓 PDF 用
builtin:会得到乱码 / 空内容;用arxiv_fulltext或jina_reader。 -
抓 SPA 用
readability:JavaScript 没渲染,正文为空;用crawl4ai/firecrawl。
souwen fetch https://example.com # builtin
souwen fetch https://example.com -p jina_reader
souwen fetch https://arxiv.org/abs/1706.03762 -p arxiv_fulltext
souwen fetch https://example.com -p crawl4ai
souwen fetch https://github.com/owner/repo -p deepwiki
souwen fetch https://example.com -p wayback
souwen fetch https://a.com https://b.com -p firecrawl --jsonfrom souwen.facade import fetch_content
resp = await fetch_content(["https://example.com"], provider="jina_reader", timeout=60)
for r in resp.results:
if r.error:
print(f"FAILED: {r.url} → {r.error}")
else:
print(r.title, len(r.content))Last calibrated:2026-05-04 · 主仓 pr-88 @ a312645`
Home · Quick Start · Architecture · FAQ · Troubleshooting · Coverage Manifest · Contributing
权威技术文档以主仓 docs/ 与 src/ 为准。本项目仅供 Python 学习与技术研究使用,禁止用于违反法律法规或第三方服务条款的用途。