CrawlForge MCP
基础工具1 credit

extract_metadata

提取全面的页面元数据,包括标题、描述、OpenGraph 标签、Twitter Card 数据和 SEO 信息。

使用场景

SEO 分析

分析页面标题、描述和关键词以进行优化

社交媒体预览数据

获取 OpenGraph 和 Twitter Card 数据,用于丰富的社交预览

内容分类

使用元数据对网页内容进行分类和整理

生成链接预览

用标题、图片和描述构建丰富的链接预览

Endpoint

POST/api/v1/tools/extract_metadata
Auth Required
Free 计划 1 req/s
1 credit

Parameters

NameTypeRequiredDefaultDescription
url
stringOptional-
要从中提取元数据的页面。`url` 与 `html` 二者必填其一。
Example: https://example.com/article
html
stringOptional-
直接解析的原始 HTML,替代抓取。
Example: <html>...</html>
include_social
booleanOptionaltrue
包含 Open Graph、Twitter 卡片、Facebook app id 与站点验证标签。
Example: true
include_seo
booleanOptionaltrue
包含 description、keywords、author、robots、canonical、标题层级与 viewport。
Example: true
include_technical
booleanOptionaltrue
包含 generator、favicon、样式表与脚本。
Example: true
include_structured_data
booleanOptionaltrue
包含页面上找到的 JSON-LD 结构化数据块。
Example: true
respect_robots
booleanOptionaltrue
遵守目标站点的 robots.txt。保持 `true` 时,robots.txt 对 `CrawlForge` 禁止的路径会在抓取之前以 403 拒绝,且不扣除 credits。仅在你与目标站点另有约定时才设为 `false`——此时响应会带上一条 `warnings`,并且该覆盖会记录到你的 API key 上。
Example: true

请求示例

cURL

terminalBash
curl -X POST https://crawlforge.dev/api/v1/tools/extract_metadata \
  -H "X-API-Key: cf_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/article"}'

TypeScript

extractMetadata.tsTypescript
const response = await fetch('https://crawlforge.dev/api/v1/tools/extract_metadata', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.CRAWLFORGE_API_KEY!,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    url: 'https://example.com/article'
  }),
});

const data = await response.json();

if (data.success) {
  const { title, description, og, twitter } = data.data;
  console.log('Title:', title);
  console.log('Description:', description);
  console.log('OG Image:', og.image);
  console.log('Twitter Card:', twitter.card);
}

响应示例

200 OK195ms
{
"success": true,
"data": {
"metadata": {
"basic": {
"title": "Example Article - Best Practices Guide",
"url": "https://example.com/article",
"lang": "en",
"charset": "utf-8"
},
"seo": {
"description": "Learn the best practices for web development",
"keywords": "web development, best practices, tutorial",
"author": "Jane Doe",
"robots": "index, follow",
"canonical": "https://example.com/article",
"headings": {
"h1": [
"Best Practices Guide"
],
"h2": [
"Getting Started",
"Common Pitfalls"
],
"h3": []
},
"meta_refresh": null,
"viewport": "width=device-width, initial-scale=1"
},
"social": {
"open_graph": {
"title": "Example Article - Best Practices Guide",
"image": "https://example.com/og-image.jpg",
"type": "article",
"site_name": "Example Site"
},
"twitter": {
"card": "summary_large_image",
"site": "@examplesite"
},
"facebook_app_id": null,
"google_site_verification": null
},
"technical": {
"generator": "Next.js",
"favicons": [
{
"rel": "icon",
"href": "/favicon.ico",
"type": "image/x-icon"
}
]
},
"structured_data": []
},
"summary": {
"has_title": true,
"has_description": true,
"has_open_graph": true,
"has_twitter_cards": true,
"has_structured_data": false,
"total_headings": 3
},
"extracted_from": "https://example.com/article",
"extraction_time": "2026-08-26T14:30:00.000Z"
},
"credits_used": 1,
"credits_remaining": 999,
"processing_time": 195
}
Field Descriptions
data.metadata.basic始终存在:标题、解析后的 url、html 的 lang 与字符集。
data.metadata.seo当 `include_seo` 为 true 时出现。包含完整的 h1/h2/h3 标题层级结构。
data.metadata.social.open_graph页面声明的全部 `og:` 属性,原样返回。页面没有声明时为 null。
data.metadata.social.twitter页面声明的全部 `twitter:` 属性。没有时为 null。
data.metadata.technical当 `include_technical` 为 true 时出现:generator、favicon、样式表与脚本。
data.metadata.structured_data页面上找到的 JSON-LD 块。没有时为空数组。
data.summary一组布尔值,便于快速检查完整性,无需遍历整个 metadata 对象。
data.extracted_from来源 URL;若您传入的是 `html`,则为字面量字符串 'provided HTML'。
data.extraction_time本次提取的 ISO 8601 时间戳。

错误处理

被 robots.txt 拦截(403 Forbidden)

目标站点的 robots.txt 对 CrawlForge 禁止了该路径。若你与目标站点另有约定,可设置 respect_robots: false 予以覆盖——该覆盖会记录到你的 API key 上。该覆盖不适用于列入 CrawlForge 永久排除名单的主机——无论 respect_robots 取何值,这类主机一律被拒绝。

相关工具

fetch_url
在提取元数据前抓取页面(1 credit)
content_analysis
分析内容质量和 SEO(4 credits)
准备好提取元数据了吗?免费注册,获取 1,000 credits。

页脚

CrawlForge MCP

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

产品

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

资源

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

开发者

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

公司

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

保持更新

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

基于 Next.js 和 MCP 协议构建

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