crawl_config.json 5.82 KB
{
  "name": "publisher_content_upload",
  "description": "内容上传技能爬取配置 - 模拟CMS发布系统接口规范",
  "version": "1.0.0",
  "created": "2026-03-27T10:00:00Z",

  "dataSources": [
    {
      "id": "cms_api_spec",
      "type": "api_spec",
      "name": "CMS内容上传接口规范",
      "description": "模拟内容发布系统的REST API接口规范",
      "endpoint": "/api/v1/contents",
      "method": "POST",
      "auth": "Bearer token",
      "contentType": "application/json",
      "rateLimit": {
        "requestsPerSecond": 5,
        "burst": 10
      },
      "retry": {
        "maxAttempts": 3,
        "backoffMs": 1000
      }
    },
    {
      "id": "metadata_api",
      "type": "api_spec",
      "name": "元数据接口",
      "description": "获取/更新内容元数据",
      "endpoint": "/api/v1/contents/{contentId}/metadata",
      "method": "GET/PUT",
      "auth": "Bearer token",
      "rateLimit": {
        "requestsPerSecond": 10,
        "burst": 20
      }
    },
    {
      "id": "validation_api",
      "type": "api_spec",
      "name": "内容验证接口",
      "description": "预校验内容是否符合发布要求",
      "endpoint": "/api/v1/contents/validate",
      "method": "POST",
      "auth": "Bearer token",
      "rateLimit": {
        "requestsPerSecond": 20,
        "burst": 50
      }
    },
    {
      "id": "publish_status_api",
      "type": "api_spec",
      "name": "发布状态查询接口",
      "description": "查询内容发布状态",
      "endpoint": "/api/v1/contents/{contentId}/status",
      "method": "GET",
      "auth": "Bearer token",
      "rateLimit": {
        "requestsPerSecond": 10,
        "burst": 20
      }
    }
  ],

  "requestSchema": {
    "type": "object",
    "required": ["title", "content", "metadata"],
    "properties": {
      "title": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100,
        "description": "剧本标题"
      },
      "content": {
        "type": "string",
        "minLength": 100,
        "maxLength": 50000,
        "description": "剧本正文"
      },
      "metadata": {
        "type": "object",
        "required": ["category", "author"],
        "properties": {
          "category": {
            "type": "string",
            "enum": ["剧情", "喜剧", "爱情", "悬疑", "科幻", "动作", "动画"],
            "description": "剧本分类"
          },
          "tags": {
            "type": "array",
            "items": {"type": "string"},
            "maxItems": 5,
            "description": "标签列表"
          },
          "author": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "description": "作者名称"
          },
          "copyright": {
            "type": "string",
            "maxLength": 200,
            "description": "版权声明"
          },
          "wordCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100000,
            "description": "字数统计"
          }
        }
      },
      "publishTime": {
        "type": "string",
        "format": "date-time",
        "description": "定时发布时间"
      },
      "status": {
        "type": "string",
        "enum": ["draft", "pending", "published"],
        "default": "draft",
        "description": "内容状态"
      }
    }
  },

  "responseSchema": {
    "success": {
      "201": {
        "description": "创建成功",
        "schema": {
          "type": "object",
          "properties": {
            "success": {"type": "boolean"},
            "data": {
              "type": "object",
              "properties": {
                "contentId": {"type": "string"},
                "status": {"type": "string"},
                "publishedAt": {"type": "string", "format": "date-time"},
                "url": {"type": "string", "format": "uri"}
              }
            }
          }
        }
      },
      "200": {
        "description": "更新成功",
        "schema": {
          "type": "object",
          "properties": {
            "success": {"type": "boolean"},
            "data": {"type": "object"}
          }
        }
      }
    },
    "error": {
      "400": {
        "description": "请求格式错误",
        "schema": {
          "type": "object",
          "properties": {
            "success": {"type": "boolean", "const": false},
            "error": {
              "type": "object",
              "properties": {
                "code": {"type": "string"},
                "message": {"type": "string"},
                "details": {"type": "array"}
              }
            }
          }
        }
      },
      "401": {
        "description": "认证失败"
      },
      "403": {
        "description": "权限不足"
      },
      "422": {
        "description": "验证失败"
      },
      "429": {
        "description": "请求过于频繁"
      },
      "500": {
        "description": "服务器内部错误"
      },
      "502": {
        "description": "网关错误"
      },
      "503": {
        "description": "服务不可用"
      },
      "504": {
        "description": "超时"
      }
    }
  },

  "errorHandling": {
    "retryableCodes": [429, 500, 502, 503, 504],
    "nonRetryableCodes": [400, 401, 403, 404, 422],
    "exponentialBackoff": {
      "initialDelayMs": 1000,
      "maxDelayMs": 30000,
      "multiplier": 2
    },
    "circuitBreaker": {
      "failureThreshold": 5,
      "resetTimeoutMs": 60000
    }
  },

  "headers": {
    "default": {
      "Content-Type": "application/json",
      "Accept": "application/json"
    },
    "auth": {
      "Authorization": "Bearer {token}"
    }
  },

  "crawlRules": {
    "respectRobotsTxt": true,
    "requestDelayMs": 2000,
    "timeoutMs": 30000,
    "maxRedirects": 3,
    "userAgent": "Publisher-Skill/1.0"
  }
}