全部产品
云市场

媒体审核

更新时间:2019-01-17 20:28:11

初始化客户端

使用前请先初始化客户端,参考 InitVodClient 接口。

提交智能审核作业

接口参数和返回字段请参考 SubmitAIMediaAuditJob

  1. package main
  2. import (
  3. "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
  4. "github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
  5. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
  6. "fmt"
  7. )
  8. func MySubmitAIMediaAuditJob(client *vod.Client) (response *vod.SubmitAIMediaAuditJobResponse, err error) {
  9. request := vod.CreateSubmitAIMediaAuditJobRequest()
  10. // 设置视频ID
  11. request.MediaId = "<VideoId>"
  12. //request.TemplateId = "<TemplateId>"
  13. request.AcceptFormat = "JSON"
  14. return client.SubmitAIMediaAuditJob(request)
  15. }
  16. func main() {
  17. client, err := InitVodClient("<accessKeyId>", "<accessKeySecret>")
  18. if err != nil {
  19. panic(err)
  20. }
  21. response, err := MySubmitAIMediaAuditJob(client)
  22. if err != nil {
  23. panic(err)
  24. }
  25. fmt.Println(response.GetHttpContentString())
  26. fmt.Println(response.JobId)
  27. }

查询智能审核作业

接口参数和返回字段请参考 GetAIMediaAuditJob

  1. package main
  2. import (
  3. "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
  4. "github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
  5. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
  6. "fmt"
  7. )
  8. func MyGetAIMediaAuditJob(client *vod.Client) (response *vod.GetAIMediaAuditJobResponse, err error) {
  9. request := vod.CreateGetAIMediaAuditJobRequest()
  10. request.JobId = "<JobId>"
  11. request.AcceptFormat = "JSON"
  12. return client.GetAIMediaAuditJob(request)
  13. }
  14. func main() {
  15. client, err := InitVodClient("<accessKeyId>", "<accessKeySecret>")
  16. if err != nil {
  17. panic(err)
  18. }
  19. response, err := MyGetAIMediaAuditJob(client)
  20. if err != nil {
  21. panic(err)
  22. }
  23. fmt.Println(response.GetHttpContentString())
  24. fmt.Println(response.MediaAuditJob)
  25. }

获取智能审核结果摘要

接口参数和返回字段请参考 GetMediaAuditResult

  1. package main
  2. import (
  3. "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
  4. "github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
  5. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
  6. "fmt"
  7. )
  8. func MyGetMediaAuditResult(client *vod.Client) (response *vod.GetMediaAuditResultResponse, err error) {
  9. request := vod.CreateGetMediaAuditResultRequest()
  10. request.MediaId = "<VideoId>"
  11. request.AcceptFormat = "JSON"
  12. return client.GetMediaAuditResult(request)
  13. }
  14. func main() {
  15. client, err := InitVodClient("<accessKeyId>", "<accessKeySecret>")
  16. if err != nil {
  17. panic(err)
  18. }
  19. response, err := MyGetMediaAuditResult(client)
  20. if err != nil {
  21. panic(err)
  22. }
  23. fmt.Println(response.GetHttpContentString())
  24. fmt.Println(response.MediaAuditResult.VideoResult)
  25. }

获取智能审核结果详情

接口参数和返回字段请参考 GetMediaAuditResultDetail

  1. package main
  2. import (
  3. "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
  4. "github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
  5. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
  6. "fmt"
  7. )
  8. func MyGetMediaAuditResultDetail(client *vod.Client) (response *vod.GetMediaAuditResultDetailResponse, err error) {
  9. request := vod.CreateGetMediaAuditResultDetailRequest()
  10. request.MediaId = "<VideoId>"
  11. request.PageNo = "1"
  12. request.AcceptFormat = "JSON"
  13. return client.GetMediaAuditResultDetail(request)
  14. }
  15. func main() {
  16. client, err := InitVodClient("<accessKeyId>", "<accessKeySecret>")
  17. if err != nil {
  18. panic(err)
  19. }
  20. response, err := MyGetMediaAuditResultDetail(client)
  21. if err != nil {
  22. panic(err)
  23. }
  24. fmt.Println(response.GetHttpContentString())
  25. fmt.Println(response.MediaAuditResultDetail.Total)
  26. fmt.Println(response.MediaAuditResultDetail.List)
  27. }

获取智能审核结果时间线

接口参数和返回字段请参考 GetMediaAuditResultTimeline

  1. package main
  2. import (
  3. "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
  4. "github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
  5. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
  6. "fmt"
  7. )
  8. func MyGetMediaAuditResultTimeline(client *vod.Client) (response *vod.GetMediaAuditResultTimelineResponse, err error) {
  9. request := vod.CreateGetMediaAuditResultTimelineRequest()
  10. request.MediaId = "<VideoId>"
  11. request.AcceptFormat = "JSON"
  12. return client.GetMediaAuditResultTimeline(request)
  13. }
  14. func main() {
  15. client, err := InitVodClient("<accessKeyId>", "<accessKeySecret>")
  16. if err != nil {
  17. panic(err)
  18. }
  19. response, err := MyGetMediaAuditResultTimeline(client)
  20. if err != nil {
  21. panic(err)
  22. }
  23. fmt.Println(response.GetHttpContentString())
  24. for _, item := range response.MediaAuditResultTimeline.Porn {
  25. fmt.Printf("%s: %s %s\n", item.Timestamp, item.Label, item.Score)
  26. }
  27. }

人工审核

接口参数和返回字段请参考 CreateAudit

  1. package main
  2. import (
  3. "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
  4. "github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
  5. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
  6. "fmt"
  7. "encoding/json"
  8. )
  9. func MyCreateAudit(client *vod.Client) (response *vod.CreateAuditResponse, err error) {
  10. request := vod.CreateCreateAuditRequest()
  11. auditContent := []map[string]interface{}{}
  12. auditItem1 := map[string]interface{}{"VideoId":"<VideoId1>", "Status":"Blocked", "Reason": "porn video"}
  13. auditItem2 := map[string]interface{}{"VideoId":"<VideoId2>", "Status":"Normal", "Reason": ""}
  14. auditContent = append(auditContent, auditItem1, auditItem2)
  15. jsonContent, err := json.Marshal(auditContent)
  16. if err != nil {
  17. fmt.Println("json.Marshal failed:", err)
  18. return
  19. }
  20. request.AuditContent = string(jsonContent)
  21. request.AcceptFormat = "JSON"
  22. return client.CreateAudit(request)
  23. }
  24. func main() {
  25. client, err := InitVodClient("<accessKeyId>", "<accessKeySecret>")
  26. if err != nil {
  27. panic(err)
  28. }
  29. response, err := MyCreateAudit(client)
  30. if err != nil {
  31. panic(err)
  32. }
  33. fmt.Println(response.GetHttpContentString())
  34. fmt.Println(response.RequestId)
  35. }

获取人工审核历史

接口参数和返回字段请参考 GetAuditHistory

  1. package main
  2. import (
  3. "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
  4. "github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
  5. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
  6. "fmt"
  7. )
  8. func MyGetAuditHistory(client *vod.Client) (response *vod.GetAuditHistoryResponse, err error) {
  9. request := vod.CreateGetAuditHistoryRequest()
  10. request.VideoId = "<VideoId>"
  11. request.PageNo = "1"
  12. request.PageSize = "10"
  13. request.AcceptFormat = "JSON"
  14. return client.GetAuditHistory(request)
  15. }
  16. func main() {
  17. client, err := InitVodClient("<accessKeyId>", "<accessKeySecret>")
  18. if err != nil {
  19. panic(err)
  20. }
  21. response, err := MyGetAuditHistory(client)
  22. if err != nil {
  23. panic(err)
  24. }
  25. fmt.Println(response.GetHttpContentString())
  26. fmt.Println(response.RequestId)
  27. for _, history := range response.Histories {
  28. fmt.Printf("%s: %s\n", history.CreationTime, history.Status)
  29. }
  30. }

设置审核安全IP

接口参数和返回字段请参考 SetAuditSecurityIp

  1. package main
  2. import (
  3. "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
  4. "github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
  5. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
  6. "fmt"
  7. )
  8. func MySetAuditSecurityIp(client *vod.Client) (response *vod.SetAuditSecurityIpResponse, err error) {
  9. request := vod.CreateSetAuditSecurityIpRequest()
  10. // 审核安全组名称,默认为Default
  11. request.SecurityGroupName = "MyGroupName"
  12. // 操作方式,默认值Append(追加IP白名单)
  13. request.OperateMode = "Cover"
  14. // 审核安全IP列表,每个分组最多支持100个并以逗号分隔
  15. request. Ips = "10.23.12.20,10.23.12.21,10.23.12.22"
  16. request.AcceptFormat = "JSON"
  17. return client.SetAuditSecurityIp(request)
  18. }
  19. func main() {
  20. client, err := InitVodClient("<accessKeyId>", "<accessKeySecret>")
  21. if err != nil {
  22. panic(err)
  23. }
  24. response, err := MySetAuditSecurityIp(client)
  25. if err != nil {
  26. panic(err)
  27. }
  28. fmt.Println(response.GetHttpContentString())
  29. fmt.Println(response.RequestId)
  30. }

获取审核安全IP列表

接口参数和返回字段请参考 ListAuditSecurityIp

  1. package main
  2. import (
  3. "github.com/aliyun/alibaba-cloud-sdk-go/sdk"
  4. "github.com/aliyun/alibaba-cloud-sdk-go/services/vod"
  5. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
  6. "fmt"
  7. )
  8. func MyListAuditSecurityIp(client *vod.Client) (response *vod.ListAuditSecurityIpResponse, err error) {
  9. request := vod.CreateListAuditSecurityIpRequest()
  10. request.SecurityGroupName = "MyGroupName"
  11. request.AcceptFormat = "JSON"
  12. return client.ListAuditSecurityIp(request)
  13. }
  14. func main() {
  15. client, err := InitVodClient("<accessKeyId>", "<accessKeySecret>")
  16. if err != nil {
  17. panic(err)
  18. }
  19. response, err := MyListAuditSecurityIp(client)
  20. if err != nil {
  21. panic(err)
  22. }
  23. fmt.Println(response.GetHttpContentString())
  24. fmt.Println(response.RequestId)
  25. for _, ipGroup := range response.SecurityIpList {
  26. fmt.Printf("%s: %s\n", ipGroup.SecurityGroupName, ipGroup.Ips)
  27. }
  28. }