{
  "openapi": "3.1.0",
  "info": {
    "title": "Download",
    "description": "API service for App Factory reusable modules",
    "version": "1.0.0",
    "x-source-commit": "f33cc2b935f31b36240d724948dc8b9c765430cc"
  },
  "paths": {
    "/api/v1/download/media/{path}": {
      "get": {
        "tags": [
          "download"
        ],
        "summary": "Download Media File",
        "description": "下载媒体文件代理端点\n\n用于代理 MinIO 中的媒体文件，支持视频、音频等文件的下载\n支持 Range 请求（视频拖动播放）\n\nArgs:\n    path: 媒体文件路径，如 videos/filename.mp4, audios/filename.mp3\n    download: true 时用 Content-Disposition: attachment（移动端「另存为」）",
        "operationId": "download_media_file_api_v1_download_media__path__get",
        "parameters": [
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Path"
            }
          },
          {
            "name": "download",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Download"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/download/cache/stats": {
      "get": {
        "tags": [
          "download"
        ],
        "summary": "Get Cache Stats",
        "description": "获取缓存统计信息（无需认证）\n\n返回缓存命中率、内存使用情况等统计数据",
        "operationId": "get_cache_stats_api_v1_download_cache_stats_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/api/v1/download/extract-text": {
      "post": {
        "tags": [
          "download"
        ],
        "summary": "Extract Text",
        "description": "提取音频文案（口播文案）\n\n从音频URL中提取口播文案文本内容\n\n返回码说明：\n- 200: 提取成功，返回文案内容\n- 202: 正在处理中，前端应每隔 retry_after 秒轮询本接口直至完成\n- 400: 请求参数错误\n- 500: 服务器内部错误",
        "operationId": "extract_text_api_v1_download_extract_text_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExtractMediaRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/download/extract-bgm": {
      "post": {
        "tags": [
          "download"
        ],
        "summary": "Extract Bgm",
        "description": "提取背景音乐\n\n从音频URL中提取背景音乐\n\n返回码说明：\n- 200: 提取成功\n- 202: 正在处理中，前端应每隔 retry_after 秒轮询本接口直至完成\n- 400: 请求参数错误\n- 500: 服务器内部错误",
        "operationId": "extract_bgm_api_v1_download_extract_bgm_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExtractMediaRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/download/extract-audio": {
      "post": {
        "tags": [
          "download"
        ],
        "summary": "Extract Audio From Video",
        "description": "从视频URL提取音频\n\n从视频URL下载并提取音频，返回音频文件URL\n\n返回码说明：\n- 200: 提取成功\n- 202: 正在处理中，前端应每隔 retry_after 秒轮询本接口直至完成\n- 400: 请求参数错误\n- 500: 服务器内部错误",
        "operationId": "extract_audio_from_video_api_v1_download_extract_audio_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExtractMediaRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/download/cache/clear": {
      "delete": {
        "tags": [
          "download"
        ],
        "summary": "Clear Cache",
        "description": "清空所有缓存\n\n需要管理员权限（当前为演示模式）",
        "operationId": "clear_cache_api_v1_download_cache_clear_delete",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ExtractMediaRequest": {
        "properties": {
          "url": {
            "type": "string",
            "title": "Url",
            "description": "媒体 URL：平台分享链，或 resolve 得到的音频/视频直链。抖音等 CDN 直链易因预览/防盗链 403，建议同时传 source_url。"
          },
          "source_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Url",
            "description": "平台原始分享/详情页 URL（如 https://v.douyin.com/xxx/）。文案/BGM 提取时用于原子「重解析新鲜音轨 + 中转到对象存储」，避免把已过期/被预览占用的 CDN 直链交给 Infer。"
          },
          "download_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Download Type",
            "description": "可选下载类型标记（前端兼容字段，后端可忽略）"
          },
          "extract_bgm": {
            "type": "boolean",
            "title": "Extract Bgm",
            "description": "是否提取背景音乐（默认不提取）",
            "default": false
          },
          "extract_transcript": {
            "type": "boolean",
            "title": "Extract Transcript",
            "description": "是否提取口播文案（默认不提取）",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "url"
        ],
        "title": "ExtractMediaRequest",
        "description": "提取媒体信息请求"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "servers": [
    {
      "url": "https://api.sniphunter.com"
    }
  ]
}