CrawlForge
首页Playground应用场景集成价格文档博客
如何将 CrawlForge 与 Dify 工作流结合使用
Tutorials
返回博客
教程

如何将 CrawlForge 与 Dify 工作流结合使用

C
CrawlForge Team
工程团队
2026年4月22日
阅读时长 7 分钟

本页内容

Dify 是一个开源的 LLM 应用开发平台,让你能够通过可视化工作流编辑器构建 AI 应用。通过将 CrawlForge 添加为自定义工具,你的 Dify 工作流便获得了 scraping 网站、搜索网页和提取结构化数据的能力 —— 全程无需编写代码。

本指南同时涵盖无代码方式(Dify 的可视化工具配置)和面向高级集成的基于 API 的方式。

目录

  • 什么是 Dify?
  • 前置条件
  • 步骤 1:设置自定义工具提供商
  • 步骤 2:定义 CrawlForge 工具 schema
  • 步骤 3:构建一个网页研究工作流
  • 步骤 4:构建一个内容提取 pipeline
  • 步骤 5:处理认证与错误
  • credits 费用参考
  • Dify 中可用的 CrawlForge 工具
  • 下一步

什么是 Dify?

Dify 是一个用于构建 LLM 应用的生产级平台。它提供可视化工作流构建器、agent 编排、RAG pipeline 管理,以及一个包含 50 多个内置工具的库。Dify 支持通过 OpenAPI 规范集成自定义工具,这意味着任何 REST API —— 包括 CrawlForge —— 都可以被添加为工具。

Dify 的原生 MCP 集成还意味着你可以直接将 CrawlForge 连接为一个 MCP server。本指南涵盖这两种方式。

前置条件

  • Dify 实例 —— Dify Cloud 或通过 Docker 自托管均可
  • 一个带 API key 的 CrawlForge 账户(1,000 个免费 credits)
  • 你 Dify 工作区的管理员权限

步骤 1:设置自定义工具提供商

在你的 Dify 控制台中,导航到 Tools > Custom Tools > Create Custom Tool。

粘贴以下 OpenAPI 规范来注册 CrawlForge 的核心工具:

Yaml
openapi: "3.0.0"
info:
  title: CrawlForge Web Scraping Tools
  version: "1.0.0"
  description: "26 specialized web scraping tools for AI applications"
servers:
  - url: https://crawlforge.dev/api/v1/tools
paths:
  /extract_content:
    post:
      operationId: extractContent
      summary: Extract clean content from a URL (2 credits)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [url]
              properties:
                url:
                  type: string
                  description: The URL to extract content from
      responses:
        "200":
          description: Extracted content
  /search_web:
    post:
      operationId: searchWeb
      summary: Search the web via Google (5 credits)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [query]
              properties:
                query:
                  type: string
                  description: Search query
                limit:
                  type: integer
                  description: Max results (default 10)
      responses:
        "200":
          description: Search results
  /fetch_url:
    post:
      operationId: fetchUrl
      summary: Fetch raw page content (1 credit)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [url]
              properties:
                url:
                  type: string
                  description: The URL to fetch
      responses:
        "200":
          description: Raw page content
  /scrape_structured:
    post:
      operationId: scrapeStructured
      summary: Extract data with CSS selectors (2 credits)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [url, selectors]
              properties:
                url:
                  type: string
                selectors:
                  type: object
                  additionalProperties:
                    type: string
      responses:
        "200":
          description: Structured extraction results

将认证方式设置为 Bearer Token,并输入你的 CrawlForge API key(cf_live_...)。

步骤 2:定义 CrawlForge 工具 schema

导入 OpenAPI 规范后,Dify 会自动为每个 endpoint 生成工具卡片。为每个工具配置具有描述性的名称,以便 LLM agent 能够正确地选用它们:

Dify 工具名称CrawlForge EndpointCreditsagent 何时应使用它
Fetch Web Page/fetch_url1用户提供了一个具体 URL 供阅读
Extract Content/extract_content2需要从页面获取干净、可读的文本
Search the Web/search_web5需要查找关于某个主题的页面
Extract Structured Data/scrape_structured2需要通过 CSS 选择器获取具体的数据点

在 Dify 中为每个工具添加一段包含 credits 费用的清晰描述。这有助于 LLM agent 做出具有成本效益的决策。

步骤 3:构建一个网页研究工作流

在 Dify 的工作流编辑器中,用以下节点创建一个新工作流:

Typescript
// Pseudocode for the Dify workflow (implemented visually in Dify's editor)

// Node 1: Start -- User provides a research topic
// Input: { topic: string }

// Node 2: Search Web (5 credits)
// Tool: CrawlForge search_web
// Input: { query: "{{topic}} latest developments 2026", limit: 5 }
// Output: search_results

// Node 3: Extract Top Results (2 credits each)
// Tool: CrawlForge extract_content
// Loop over: search_results.results[0..2]
// Input: { url: "{{item.link}}" }
// Output: extracted_pages[]

// Node 4: LLM Synthesis
// Model: Claude Sonnet
// Prompt: "Synthesize these sources into a research brief: {{extracted_pages}}"
// Output: research_summary

// Node 5: End -- Return research_summary to user
// Total credits: 5 + (3 * 2) = 11 credits per run

Dify 的可视化工作流让这一切成为拖放操作。每个节点与下一个节点相连,数据通过模板变量在其间流动。

步骤 4:构建一个内容提取 pipeline

对于反复进行的数据提取任务,构建一个 pipeline 工作流:

Typescript
// Dify workflow for daily competitor monitoring

// Node 1: Start (triggered by schedule or API call)
// Input: { urls: ["https://competitor1.com/pricing", "https://competitor2.com/pricing"] }

// Node 2: Batch Extract (2 credits per URL)
// Tool: CrawlForge scrape_structured
// Loop over: urls
// Input: {
//   url: "{{item}}",
//   selectors: {
//     plans: ".pricing-plan h3",
//     prices: ".pricing-plan .price",
//     features: ".pricing-plan .feature-list"
//   }
// }
// Output: pricing_data[]

// Node 3: LLM Analysis
// Model: Claude Haiku (for cost efficiency)
// Prompt: "Compare these pricing pages and highlight any changes: {{pricing_data}}"
// Output: analysis

// Node 4: Conditional -- if changes detected, send notification
// Node 5: End
// Total: 2 * number_of_urls credits per run

步骤 5:处理认证与错误

认证

CrawlForge 使用 Bearer token 认证。在 Dify 中,在自定义工具提供商层级设置一次即可:

  1. 前往 Tools > Custom Tools > CrawlForge
  2. 点击 Configure Authorization
  3. 选择 API Key (Bearer)
  4. 输入你的 CrawlForge API key

工作流中的所有工具调用都会自动包含认证头。

错误处理

在你的 Dify 工作流中为常见情形添加错误处理节点:

Typescript
// Error handling pattern for Dify workflows

// After each CrawlForge tool node, add a conditional:
// If response.status === 402 -> "Insufficient credits"
//   -> Notify user to top up at crawlforge.dev/pricing
// If response.status === 429 -> "Rate limited"
//   -> Wait 2 seconds, retry the node
// If response.status === 500 -> "Server error"
//   -> Log error, skip this URL, continue workflow

Dify 内置的重试机制会自动处理瞬时故障。对于 credits 耗尽错误(HTTP 402),将其路由到一个用于提醒用户的通知节点。

credits 费用参考

Credits工具Dify 工作流使用场景
1fetch_url、extract_text、extract_links、extract_metadata简单的页面抓取触发
2scrape_structured、extract_content、map_site、process_document、localization提取 pipeline 节点、站点审计工作流
3track_changes、analyze_content变更检测、内容分析
4summarize_content、crawl_deep摘要生成、多页面 crawling
5search_web、batch_scrape、scrape_with_actions、stealth_mode研究和批量工作流
10deep_research全面分析工作流

Dify 中可用的 CrawlForge 工具

全部 20 个 CrawlForge 工具都可以注册到 Dify 中。在可视化工作流中最常用的是:

工具Credits它在 Dify 中表现出色的原因
search_web5研究工作流的自然起点
extract_content2干净的输出可直接喂给 LLM 节点
scrape_structured2CSS 选择器返回可预测的结构化 JSON
fetch_url1简单页面访问的最便宜选项
batch_scrape5比逐次调用更高效地处理循环

下一步

  • Dify 文档 —— Dify 平台官方文档
  • CrawlForge API 参考 —— 全部 26 个工具的 endpoint schema
  • 完整 MCP 指南 —— 理解 MCP 协议集成
  • CrawlForge 定价 —— credit 套餐起价 $19/月

今天就为你的 Dify 应用添加 web scraping 能力。 获取你的免费 API key,含 1,000 credits,并在 Dify 中将 CrawlForge 注册为自定义工具。无需代码。

亲自试一试——无需注册

在 Playground 中运行 CrawlForge 的 27 个抓取与提取工具中的任意一个,然后免费开始,获取 1,000 credits。

1,000 免费 credits • 每月补充 • 无需信用卡

标签

difyllm-platformmcpintegrationtutorialno-codeweb-scrapingworkflow

关于作者

C

CrawlForge Team

工程团队

我们正在打造功能最全面的 Web 抓取 MCP server。我们开发的工具帮助开发者为 AI 应用提取、分析和转换 Web 数据。

及时获取最新洞察

将教程、产品更新与 Web 抓取技巧直接发送到你的收件箱。

拒绝垃圾邮件,随时可取消订阅。

付诸实践

在任意 URL 上测试 CrawlForge 的工具——免费,无需注册。

本页内容

相关文章

如何在 Make 和 Zapier 中使用 CrawlForge
Tutorials

如何在 Make 和 Zapier 中使用 CrawlForge

把 CrawlForge 接入 Make(Integromat)和 Zapier,实现自动化网页抓取。借助 HTTP 模块、webhook 和工作流示例完成无代码配置。

C
CrawlForge Team
|
4月23日
|
8 分钟
如何在 n8n 中使用 CrawlForge:工作流自动化指南
Tutorials

如何在 n8n 中使用 CrawlForge:工作流自动化指南

将 CrawlForge MCP 连接到 n8n,实现自动化的 web scraping 工作流。构建无需代码的流水线,按计划提取、转换并加载网络数据。

C
CrawlForge Team
|
4月5日
|
7 分钟
如何在 LangGraph 智能体中使用 CrawlForge
Tutorials

如何在 LangGraph 智能体中使用 CrawlForge

使用 LangGraph 和 CrawlForge 构建有状态的网页爬取智能体。本篇 TypeScript 指南涵盖图节点、状态管理以及条件化的爬取流程。

C
CrawlForge Team
|
4月24日
|
8 分钟

页脚

CrawlForge

面向 AI Agent 的企业级网页抓取。27 个专业 MCP 工具,专为构建智能系统的现代开发者而设计。

产品

  • 功能
  • Playground
  • 价格
  • 应用场景
  • 集成
  • 替代方案
  • 更新日志

资源

  • 快速上手
  • API 参考
  • 模板
  • 指南
  • 博客
  • 术语表
  • 常见问题
  • 网站地图

开发者

  • MCP 协议
  • Claude Desktop
  • Cursor IDE
  • LangChain
  • LlamaIndex

公司

  • 关于我们
  • 联系我们
  • 隐私政策
  • 服务条款
  • 可接受使用政策
  • Cookie

保持更新

获取新工具和新功能的最新动态。

基于 Next.js 和 MCP 协议构建

© 2025-2026 CrawlForge。保留所有权利。