{
  "siteId": "douyin_creator",
  "taskType": "save_video_draft",
  "platform": "douyin",
  "name": "保存抖音视频草稿",
  "description": "在抖音创作者平台保存视频为草稿",
  "requiredFields": [
    {
      "name": "title",
      "type": "string",
      "description": "视频标题",
      "validation": "length:1-30"
    },
    {
      "name": "video",
      "type": "string",
      "description": "视频文件路径"
    }
  ],
  "optionalFields": [
    {
      "name": "content",
      "type": "string",
      "description": "视频描述正文"
    }
  ],
  "nodes": [
    {
      "nodeId": "ensure_publish_ready",
      "name": "ensure_publish_ready",
      "tool": "ensure_publish_ready",
      "args": {
        "initialDelayMs": 5000
      }
    },
    {
      "nodeId": "wait_page_ready",
      "name": "wait_page_ready",
      "tool": "wait",
      "args": {
        "delayMs": 5000,
        "message": "等待发布页面完全加载"
      }
    },
    {
      "nodeId": "upload_video",
      "name": "upload_video",
      "tool": "upload_assets",
      "args": {
        "field": "video",
        "assets": ["{{data.video}}"],
        "timeoutMs": 600000
      }
    },
    {
      "nodeId": "fill_title",
      "name": "fill_title",
      "tool": "fill_field",
      "args": {
        "field": "title",
        "value": "{{data.title}}"
      }
    },
    {
      "nodeId": "fill_content",
      "name": "fill_content",
      "when": "exists(payload.content)",
      "tool": "fill_field",
      "args": {
        "field": "content",
        "value": "{{data.content}}"
      }
    },
    {
      "nodeId": "submit_save_draft",
      "name": "save_draft",
      "tool": "trigger_action",
      "preconditions": [
        {
          "type": "element_visible",
          "selector": "video[src][loop]"
        },
        {
          "type": "element_visible",
          "selector": "#phoneText"
        }
      ],
      "args": {
        "action": "saveDraft"
      }
    }
  ],
  "validation": [
    {
      "rule": "title.length >= 1",
      "message": "需要提供视频标题"
    },
    {
      "rule": "title.length <= 30",
      "message": "视频标题不能超过30字"
    },
    {
      "rule": "video.length >= 1",
      "message": "需要提供视频文件路径"
    },
    {
      "rule": "content.length <= 1000",
      "message": "视频描述正文不能超过1000字"
    }
  ]
}
