Query Intelligent Subtitle Content
Updated: 2023-06-02 00:15:31
API Description
1、通过字幕任务id,查询视频字幕的链接和字幕内容(需先创建字幕任务)
2、接口支持https协议
API URL
http://api.polyv.net/vod/v4/smart-subtitle/get
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls are subject to rate limits. See details
Request Parameter Description
- URL Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Live streaming appId. You can view your live streaming appId and appSecret in "Cloud VOD" -> "Settings" -> "API Interface" |
| timestamp | true | Long | Current time in milliseconds timestamp, valid within 30 minutes |
| taskId | true | Long | Subtitle task id, returned when creating a subtitle task |
| sign | true | String | Signature, 32-character uppercase MD5 value See MD5 signature generation rules |
Example
https://api.polyv.net/vod/v4/smart-subtitle/get
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure See global error description |
| status | String | Response status text |
| requestId | String | Unique request identifier. If the API call fails, provide this id to customer service for troubleshooting |
| success | boolean | true indicates successful API call, false indicates failure |
| data | Object | Subtitle data returned on success See data field description |
| error | Object | Error description when API call fails See error field description |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| taskId | Long | Subtitle task id |
| link | String | Subtitle link |
| autoApplyEnabled | String | Whether to automatically apply subtitles to the corresponding video after generation. Y means auto-apply, N means do not auto-apply |
| subtitleName | String | Subtitle title |
| preferenceEnabled | String | Whether it is the default preferred video subtitle. Y means default preferred, N means not |
| subtitles | List | Subtitle content See subtitle content field description |
Subtitle Content Field Description
| Parameter | Type | Description |
|---|---|---|
| start | Long | Start time of a single subtitle relative to video playback, in milliseconds |
| end | Long | End time of a single subtitle relative to video playback, in milliseconds |
| content | String | Content of a single subtitle |
error Field Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code See return error code list |
| desc | String | Error description See return error code list |
Return Error Code List
| code | desc | Description |
|---|---|---|
| 10002 | Signature error | Signature error. Check if the API sign parameter is correctly generated |
| 10003 | Timestamp expired | Timestamp expired |
| 20003 | application not found. | appId does not exist. Check if appId is passed correctly |
| 56810 | Subtitle task does not exist or has been deleted | Subtitle task does not exist or has been deleted |
| 56812 | Subtitles are being generated, please try again later | Video subtitle parsing task is not completed |
Response Example
Success Example
{
"code": 200,
"status": "success",
"requestId": "f813d5d2359743028b6648e54ade1bf1.60.16801640807450383",
"data": {
"taskId": 1120,
"link": "https://img.videocc.net/usrt/8/833584471d/srt/55016df7-2381-41b7-b594-bf3e5f058561.srt",
"autoApplyEnabled": "N",
"subtitleName": "智能字幕",
"preferenceEnabled": "Y",
"subtitles": [
{
"start": 0,
"end": 1130,
"content": "今天,"
},
{
"start": 1210,
"end": 4340,
"content": "当我们想在生活中学习一些新知识的时候,"
},
{
"start": 4630,
"end": 8270,
"content": "大部分人想到的是去搜索对应的视频教程,"
},
{
"start": 8980,
"end": 13700,
"content": "同时越来越多的企业也正在尝试使用视频进行培训。"
}
]
},
"success": true
}
Error Example
Timestamp Expired
{
"code": 400,
"status": "error",
"error": {
"code": 10003,
"desc": "时间戳过期"
},
"success": false
}
Signature Error
{
"code": 403,
"status": "error",
"error": {
"code": 10002,
"desc": "签名错误"
},
"success": false
}
Subtitle Does Not Exist or Has Been Deleted
{
"code": 400,
"status": "error",
"requestId": "f813d5d2359743028b6648e54ade1bf1.53.16801641320540391",
"error": {
"code": 56810,
"desc": "字幕任务不存在或已删除"
},
"data": null,
"success": false
}
