ASS水印快速替换全套API

ASS水印快速替换功能的添加ASS水印配置、编辑、删除、获取和设置等API。

添加ASS水印配置

POST /api/assconfig

请求头:
- Content-Type: application/json
- token: {apikey} // 或在请求体/URL参数中使用apikey

请求体:
{
    "apikey": "5c20cEga22FgG7f",  // 如果未在header中设置
    "configs": [{
        "title": "水印1",         // 水印标题
        "ass": "ASS字幕内容...",  // ASS字幕内容
        "startTime": "00:02:00",  // 开始时间(时:分:秒)
        "duration": 60            // 持续时间(秒)
    }]
}

返回示例:
{
    "success": true,
    "results": [{
        "success": true,
        "id": "507f1f77bcf86cd799439011",
        "title": "水印1",
        "adjustedStartTime": "00:02:00",
        "adjustedDuration": 60
    }]
}

curl示例:
curl -X POST http://your-domain/api/assconfig \
    -H "Content-Type: application/json" \
    -d '{"apikey":"5c20cEga22FgG7f","configs":[{"title":"水印1","ass":"ASS内容","startTime":"00:02:00","duration":60}]}'

获取ASS水印配置列表

GET /api/assconfigs?apikey=5c20cEga22FgG7f

返回示例:
{
    "success": true,
    "configs": [{
        "_id": "507f1f77bcf86cd799439011",
        "title": "水印1",
        "startTime": "00:02:00",
        "duration": 60,
        "assContent": "ASS字幕内容..."
    }]
}

curl示例:
curl "http://your-domain/api/assconfigs?apikey=5c20cEga22FgG7f"

更新ASS水印配置

PUT /api/assconfig/{id} //id为ASS水印配置id


#直接替换整个ASS内容,请求体:
{
    "apikey": "5c20cEga22FgG7f",
    "assContent": "[Script Info]\nScriptType: v4.00+\nPlayResX: 960\nPlayResY: 540\n\n[V4+ Styles]\nFormat: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding\nStyle: Default,锐字云字库准圆体GBK,20,&H00DBDBDD,&H000000FF,&H00000000,&H00000000,0,0,0,0,96.1111,100,0,0,1,0,0.9,2,7,7,10,1\n\n[Events]\nFormat: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\nDialogue: 0,0:00:00.00,0:00:20.00,*Default,NTP,0,0,0,,{\\an2}{\\shad0.5\\}{\\bord1}{\\fs35}{\\fn方正大黑简体}BING AWS  {\\c&H00F0FF&}WWW.EXAMPLE.COM{\\c&HFFFFFF&} BING AWS"
}

#替换关键词,请求体:
{
    "apikey": "5c20cEga22FgG7f",
    "replaceKeywords": {
        "BING": "AWS",
        "BING.com": "WWW.EXAMPLE.COM",
        "AWS": "BING"
    }
}

#返回示例:
{
    "success": true,
    "id": "507f1f77bcf86cd799439011",
    "title": "水印1"
}

#curl示例1(替换整个内容):
curl -X PUT http://your-domain/api/assconfig/507f1f77bcf86cd799439011 \
    -H "Content-Type: application/json" \
    -d '{
        "apikey":"5c20cEga22FgG7f",
        "assContent":"[Script Info]\nScriptType: v4.00+\nPlayResX: 960\nPlayResY: 540\n\n[V4+ Styles]\nFormat: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding\nStyle: Default,锐字云字库准圆体GBK,20,&H00DBDBDD,&H000000FF,&H00000000,&H00000000,0,0,0,0,96.1111,100,0,0,1,0,0.9,2,7,7,10,1\n\n[Events]\nFormat: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\nDialogue: 0,0:00:00.00,0:00:20.00,*Default,NTP,0,0,0,,{\\an2}{\\shad0.5\\}{\\bord1}{\\fs35}{\\fn方正大黑简体}BING AWS  {\\c&H00F0FF&}WWW.EXAMPLE.COM{\\c&HFFFFFF&} BING AWS"
    }'

#curl示例2(替换关键词):
curl -X PUT http://your-domain/api/assconfig/507f1f77bcf86cd799439011 \
    -H "Content-Type: application/json" \
    -d '{
        "apikey":"5c20cEga22FgG7f",
        "replaceKeywords":{
            "BING": "AWS",
            "BING.com": "WWW.EXAMPLE.COM",
            "AWS": "BING"
        }
    }'

删除ASS水印配置

POST /api/assconfig/delete

请求头:
- Content-Type: application/json
- token: {apikey} (可选)

请求体:
{
    "apikey": "5c20cEga22FgG7f",
    "ids": ["507f1f77bcf86cd799439011", "507f1f77bcf86cd799439012"] //id为ASS水印配置id
}

返回示例:
{
    "success": true,
    "results": [{
        "id": "507f1f77bcf86cd799439011",
        "success": true
    }]
}

curl示例:
curl -X POST http://your-domain/api/assconfig/delete \
    -H "Content-Type: application/json" \
    -d '{"apikey":"5c20cEga22FgG7f","ids":["507f1f77bcf86cd799439011"]}'

获取ASS水印设置

GET /api/asssetting?apikey=5c20cEga22FgG7f

返回示例:
{
    "success": true,
    "setting": {
        "mark": "watermark123",    // 水印标识
        "open": true,              // 是否开启添加/替换
        "delad": false,            // 是否开启移除
        "num": 3                   // 并发处理数
    }
}

curl示例:
curl "http://your-domain/api/asssetting?apikey=5c20cEga22FgG7f"

更新ASS水印设置

POST /api/asssetting

请求头:
- Content-Type: application/json
- token: {apikey} (可选)

请求体:
{
    "apikey": "5c20cEga22FgG7f",
    "mark": "watermark123",    // 水印标识(必填,仅允许英文数字)
    "open": true,              // 是否开启添加/替换
    "delad": false,            // 是否开启移除
    "num": 3                   // 并发处理数(>0的整数)
}

返回示例:
{
    "success": true,
    "setting": {
        "mark": "watermark123",
        "open": true,
        "delad": false,
        "num": 3
    }
}

curl示例:
curl -X POST http://your-domain/api/asssetting \
    -H "Content-Type: application/json" \
    -d '{"apikey":"5c20cEga22FgG7f","mark":"watermark123","open":true,"delad":false,"num":3}'