Firecrawl Skill
Powerful web scraping powered by Firecrawl - turn websites into LLM-ready markdown.
Overview
Firecrawl provides APIs for:
- - Scrape - Single page extraction to markdown
- Crawl - Entire site crawling with depth control
- Map - URL discovery from a starting point
- Batch - Multiple URL processing
- Extract - Structured data extraction with schemas
Prerequisites
- 1. Firecrawl API Key - Get free tier at https://firecrawl.dev
- Install Python dependencies: INLINECODE0
Configuration
Set environment variable:
CODEBLOCK0
Usage
Single Page Scraping
CODEBLOCK1
Site Crawling
CODEBLOCK2
URL Mapping
CODEBLOCK3
Batch Processing
CODEBLOCK4
Structured Extraction
CODEBLOCK5
Output Formats
Markdown
Clean, LLM-ready markdown with:
- - Headings preserved
- Links converted to markdown format
- Images with alt text
- Tables formatted as markdown tables
HTML
Raw or cleaned HTML
Links
Extracted link lists for further crawling
Screenshot
Page screenshot (if requested)
Use Cases
Knowledge Base Building
CODEBLOCK6
Research & Analysis
CODEBLOCK7
Content Migration
CODEBLOCK8
Scripts
All functionality via scripts/firecrawl.py:
- - Handles API authentication
- Automatic rate limiting
- Retry logic for failures
- Progress tracking for large crawls
Integration
Works well with:
- -
markdown-sync-pro - Sync scraped content to Notion/GitHub - INLINECODE3 - Combine with academic paper downloads
- INLINECODE4 - Scrape financial data for analysis
Firecrawl 技能
由 Firecrawl 驱动的强大网页抓取工具——将网站转换为适用于大语言模型的 Markdown 格式。
概述
Firecrawl 提供以下 API:
- - Scrape(抓取) - 单页面提取为 Markdown
- Crawl(爬取) - 全站爬取,支持深度控制
- Map(映射) - 从起始点发现 URL
- Batch(批量) - 多 URL 处理
- Extract(提取) - 基于模式的结构化数据提取
前置条件
- 1. Firecrawl API 密钥 - 在 https://firecrawl.dev 获取免费套餐
- 安装 Python 依赖:requests
配置
设置环境变量:
bash
export FIRECRAWLAPIKEY=fc-你的-api-密钥
使用方法
单页面抓取
bash
基础抓取
firecrawl scrape https://example.com
带特定选项
firecrawl scrape https://example.com --formats markdown,html --only-main-content
等待 JS 渲染
firecrawl scrape https://spa-app.com --wait-for 2000
网站爬取
bash
爬取整个网站(限制数量)
firecrawl crawl https://docs.example.com --limit 50
带深度控制
firecrawl crawl https://blog.example.com --max-depth 2 --limit 100
包含/排除模式
firecrawl crawl https://site.com --include /blog/
--exclude /admin/
自定义格式
firecrawl crawl https://docs.example.com --formats markdown,links
URL 映射
bash
发现网站所有 URL
firecrawl map https://example.com
带搜索词
firecrawl map https://docs.python.org --search tutorial
批量处理
bash
抓取多个 URL
firecrawl batch urls.txt --output ./scraped/
从 JSON 列表
firecrawl batch urls.json --formats markdown --concurrency 5
结构化提取
bash
使用 CSS 选择器提取特定数据
firecrawl extract https://example.com/products \
--schema {name: .product-title, price: .price, description: .desc}
提取为 JSON
firecrawl extract https://news.example.com/article --schema article-schema.json
输出格式
Markdown
干净、适合大语言模型的 Markdown,包含:
- - 保留标题层级
- 链接转换为 Markdown 格式
- 带替代文本的图片
- 表格格式化为 Markdown 表格
HTML
原始或清理后的 HTML
链接
提取的链接列表,用于进一步爬取
截图
页面截图(如请求)
使用场景
知识库构建
bash
爬取文档网站
firecrawl crawl https://docs.framework.com --limit 200 -o ./kb/
合并为单个文件用于 RAG
cat ./kb/*.md > knowledge-base.md
研究与分析
bash
抓取竞品定价
firecrawl batch competitors.txt --extract pricing-schema.json
监控博客更新
firecrawl map https://blog.company.com --since 2024-01-01
内容迁移
bash
导出旧 CMS 内容
firecrawl crawl https://old-site.com --formats markdown,html -o ./export/
脚本
所有功能通过 scripts/firecrawl.py 实现:
- - 处理 API 认证
- 自动速率限制
- 失败重试逻辑
- 大型爬取进度追踪
集成
与以下工具配合良好:
- - markdown-sync-pro - 将抓取内容同步到 Notion/GitHub
- arxiv-paper - 结合学术论文下载
- maybe-finance - 抓取金融数据用于分析