全部产品
云市场

媒体审核

更新时间:2019-01-17 09:58:27

初始化客户端

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

提交智能审核作业

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

  1. import com.aliyuncs.vod.model.v20170321.SubmitAIMediaAuditJobRequest;
  2. import com.aliyuncs.vod.model.v20170321.SubmitAIMediaAuditJobResponse;
  3. /**
  4. * 提交智能审核作业
  5. */
  6. public static SubmitAIMediaAuditJobResponse submitAIMediaAuditJob(DefaultAcsClient client) throws Exception {
  7. SubmitAIMediaAuditJobRequest request = new SubmitAIMediaAuditJobRequest();
  8. // 设置视频ID
  9. request.setMediaId("dc063078c1d845139e2a5bd8ffxxxxxx");
  10. // 返回结果
  11. return client.getAcsResponse(request);
  12. }
  13. /**
  14. * 以下为调用示例
  15. * @param args
  16. */
  17. public static void main(String[] args) throws Exception {
  18. // 初始化客户端
  19. DefaultAcsClient client = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  20. try {
  21. // 获取执行结果
  22. SubmitAIMediaAuditJobResponse response = submitAIMediaAuditJob(client);
  23. // 打印请求ID
  24. System.out.println("ResquestId:" + response.getRequestId());
  25. // 打印视频ID
  26. System.out.println("MediaId:" + response.getMediaId());
  27. // 打印作业ID
  28. System.out.println("JobId:" + response.getJobId());
  29. } catch (Exception e) {
  30. System.out.println("ErrorMessage:" + e.getLocalizedMessage());
  31. }
  32. }

查询智能审核作业

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

  1. import com.aliyuncs.vod.model.v20170321.GetAIMediaAuditJobRequest;
  2. import com.aliyuncs.vod.model.v20170321.GetAIMediaAuditJobResponse;
  3. /**
  4. * 查询智能审核作业
  5. */
  6. public static GetAIMediaAuditJobResponse getAIMediaAuditJob(DefaultAcsClient client) throws Exception {
  7. GetAIMediaAuditJobRequest request = new GetAIMediaAuditJobRequest();
  8. // 设置作业ID
  9. request.setJobId("7dc69b893c8b4f13b47aae8de0xxxxxx");
  10. // 返回结果
  11. return client.getAcsResponse(request);
  12. }
  13. /**
  14. * 以下为调用示例
  15. * @param args
  16. */
  17. public static void main(String[] args) throws Exception {
  18. // 初始化客户端
  19. DefaultAcsClient client = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  20. try {
  21. // 获取执行结果
  22. GetAIMediaAuditJobResponse response = getAIMediaAuditJob(client);
  23. // 打印请求ID
  24. System.out.println("ResquestId:" + response.getRequestId());
  25. // 打印结果信息
  26. System.out.println("MediaId:" + response.getMediaAuditJob().getMediaId());
  27. System.out.println("JobId:" + response.getMediaAuditJob().getJobId());
  28. System.out.println("Type:" + response.getMediaAuditJob().getType());
  29. System.out.println("Status:" + response.getMediaAuditJob().getStatus());
  30. System.out.println("Code:" + response.getMediaAuditJob().getCode());
  31. System.out.println("Message:" + response.getMediaAuditJob().getMessage());
  32. System.out.println("Data AbnormalModules:" + response.getMediaAuditJob().getData().getAbnormalModules());
  33. System.out.println("Data Label:" + response.getMediaAuditJob().getData().getLabel());
  34. System.out.println("Data Suggestion:" + response.getMediaAuditJob().getData().getSuggestion());
  35. } catch (Exception e) {
  36. System.out.println("ErrorMessage:" + e.getLocalizedMessage());
  37. }
  38. }

获取智能审核结果摘要

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

  1. import com.aliyuncs.vod.model.v20170321.GetMediaAuditResultRequest;
  2. import com.aliyuncs.vod.model.v20170321.GetMediaAuditResultResponse;
  3. /**
  4. * 获取智能审核结果摘要
  5. */
  6. public static GetMediaAuditResultResponse getMediaAuditResult(DefaultAcsClient client) throws Exception {
  7. GetMediaAuditResultRequest request = new GetMediaAuditResultRequest();
  8. // 设置视频ID
  9. request.setMediaId("dc063078c1d845139e2a5bd8fxxxxxx");
  10. // 返回结果
  11. return client.getAcsResponse(request);
  12. }
  13. /**
  14. * 以下为调用示例
  15. * @param args
  16. */
  17. // 调用示例
  18. public static void main(String[] args) throws Exception {
  19. // 初始化客户端
  20. DefaultAcsClient client = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  21. try {
  22. // 获取执行结果
  23. GetMediaAuditResultResponse response = getMediaAuditResult(client);
  24. // 打印请求ID
  25. System.out.println("ResquestId:" + response.getRequestId());
  26. // 打印作业结果信息
  27. System.out.println("Data AbnormalModules:" + response.getMediaAuditResult().getAbnormalModules());
  28. System.out.println("Data Label:" + response.getMediaAuditResult().getLabel());
  29. System.out.println("Data Suggestion:" + response.getMediaAuditResult().getSuggestion());
  30. } catch (Exception e) {
  31. System.out.println("ErrorMessage:" + e.getLocalizedMessage());
  32. }
  33. }

获取智能审核结果详情

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

  1. import com.aliyuncs.vod.model.v20170321.GetMediaAuditResultDetailRequest;
  2. import com.aliyuncs.vod.model.v20170321.GetMediaAuditResultDetailResponse;
  3. /**
  4. * 获取智能审核结果详情
  5. */
  6. public static GetMediaAuditResultDetailResponse getMediaAuditResultDetail(DefaultAcsClient client) throws Exception {
  7. GetMediaAuditResultDetailRequest request = new GetMediaAuditResultDetailRequest();
  8. // 设置视频ID
  9. request.setMediaId("dc063078c1d845139e2a5bd8fxxxxxx");
  10. // 设置翻页页数
  11. request.setPageNo(1);
  12. // 返回结果
  13. return client.getAcsResponse(request);
  14. }
  15. /**
  16. * 以下为调用示例
  17. * @param args
  18. */
  19. public static void main(String[] args) throws Exception {
  20. // 初始化客户端
  21. DefaultAcsClient client = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  22. try {
  23. // 获取执行结果
  24. GetMediaAuditResultDetailResponse response = getMediaAuditResultDetail(client);
  25. // 打印请求ID
  26. System.out.println("ResquestId:" + response.getRequestId());
  27. // 打印结果信息
  28. System.out.println("Data Total:" + response.getMediaAuditResultDetail().getTotal());
  29. System.out.println("Data List Size:" + response.getMediaAuditResultDetail().getList().size());
  30. } catch (Exception e) {
  31. System.out.println("ErrorMessage:" + e.getLocalizedMessage());
  32. }
  33. }

获取智能审核结果时间线

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

  1. import com.aliyuncs.vod.model.v20170321.GetMediaAuditResultTimelineRequest;
  2. import com.aliyuncs.vod.model.v20170321.GetMediaAuditResultTimelineResponse;
  3. /**
  4. * 获取智能审核结果时间线
  5. */
  6. public static GetMediaAuditResultTimelineResponse getMediaAuditResultTimeline(DefaultAcsClient client) throws Exception {
  7. GetMediaAuditResultTimelineRequest request = new GetMediaAuditResultTimelineRequest();
  8. // 设置视频ID
  9. request.setMediaId("dc063078c1d845139e2a5bd8fxxxxxx");
  10. // 返回结果
  11. return client.getAcsResponse(request);
  12. }
  13. /**
  14. * 以下为调用示例
  15. * @param args
  16. */
  17. public static void main(String[] args) throws Exception {
  18. // 初始化客户端
  19. DefaultAcsClient client = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  20. try {
  21. // 获取执行结果
  22. GetMediaAuditResultTimelineResponse response = getMediaAuditResultTimeline(client);
  23. // 打印请求ID
  24. System.out.println("ResquestId:" + response.getRequestId());
  25. // 打印结果信息
  26. System.out.println(response.getMediaAuditResultTimeline().getTerrorism());
  27. System.out.println(response.getMediaAuditResultTimeline().getPorn());
  28. } catch (Exception e) {
  29. System.out.println("ErrorMessage:" + e.getLocalizedMessage());
  30. }
  31. }

人工审核

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

  1. import com.aliyuncs.vod.model.v20170321.CreateAuditRequest;
  2. import com.aliyuncs.vod.model.v20170321.CreateAuditResponse;
  3. import com.alibaba.fastjson.JSONObject;
  4. /**
  5. * 构建审核内容
  6. */
  7. public static String buildAuditContent() throws Exception {
  8. List<JSONObject> auditContents = new ArrayList<>();
  9. JSONObject auditContent = new JSONObject();
  10. auditContent.put("VideoId", "3ebc10160bda481ca9b6858a0bxxxxxx"); // 视频ID
  11. auditContent.put("Status", "Blocked"); // 审核状态
  12. auditContent.put("Reason", "含有淫秽色情内容"); // 若审核状态为屏蔽时,需给出屏蔽的理由,最长支持128字节
  13. auditContents.add(auditContent);
  14. return auditContents.toString();
  15. }
  16. /**
  17. * 人工审核
  18. */
  19. public static CreateAuditResponse createAudit(DefaultAcsClient client) throws Exception {
  20. CreateAuditRequest request = new CreateAuditRequest();
  21. // 设置审核内容
  22. request.setAuditContent(buildAuditContent());
  23. // 返回结果
  24. return client.getAcsResponse(request);
  25. }
  26. /**
  27. * 以下为调用示例
  28. * @param args
  29. */
  30. public static void main(String[] args) throws Exception {
  31. DefaultAcsClient client = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  32. try {
  33. // 提交人工审核结果
  34. CreateAuditResponse response = createAudit(client);
  35. // 打印请求ID
  36. System.out.println("ResquestId:" + response.getRequestId());
  37. } catch (Exception e) {
  38. System.out.println("ErrorMessage:" + e.getLocalizedMessage());
  39. }
  40. }

获取人工审核历史

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

  1. import com.aliyuncs.vod.model.v20170321.GetAuditHistoryRequest;
  2. import com.aliyuncs.vod.model.v20170321.GetAuditHistoryResponse;
  3. /**
  4. * 获取人工审核历史
  5. */
  6. public static GetAuditHistoryResponse getAuditHistory(DefaultAcsClient client) throws Exception {
  7. GetAuditHistoryRequest request = new GetAuditHistoryRequest();
  8. // 视频ID
  9. request.setVideoId("3ebc10160bda481ca9b6858a0bxxxxxx");
  10. // 页号
  11. request.setPageNo(1L);
  12. // 每页数量
  13. request.setPageSize(10L);
  14. // 返回结果
  15. return client.getAcsResponse(request);
  16. }
  17. /**
  18. * 以下为调用示例
  19. * @param args
  20. */
  21. public static void main(String[] args) throws Exception {
  22. DefaultAcsClient client = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  23. try {
  24. // 获取人工审核历史
  25. GetAuditHistoryResponse response = getAuditHistory(client);
  26. // 打印请求ID
  27. System.out.println("ResquestId:" + response.getRequestId());
  28. // 打印审核历史记录总条数
  29. System.out.println("Total:" + response.getTotal());
  30. // 打印本次审核结果
  31. System.out.println("Status:" + response.getStatus());
  32. // 打印审核历史记录列表
  33. System.out.println("Histories:" + response.getHistories().toString());
  34. } catch (Exception e) {
  35. System.out.println("ErrorMessage:" + e.getLocalizedMessage());
  36. }
  37. }

设置审核安全IP

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

  1. import com.aliyuncs.vod.model.v20170321.SetAuditSecurityIpRequest;
  2. import com.aliyuncs.vod.model.v20170321.SetAuditSecurityIpResponse;
  3. /**
  4. * 设置审核安全IP
  5. */
  6. public static SetAuditSecurityIpResponse setAuditSecurityIp(DefaultAcsClient client) throws Exception {
  7. SetAuditSecurityIpRequest request = new SetAuditSecurityIpRequest();
  8. // 审核安全组名称,默认为Default
  9. request.setSecurityGroupName("MyGroupName");
  10. // 操作方式,默认值Append(追加IP白名单)
  11. request.setOperateMode("Cover");
  12. // 审核安全IP列表
  13. request.setIps("10.23.12.20,10.23.12.21,10.23.12.22");
  14. // 返回结果
  15. return client.getAcsResponse(request);
  16. }
  17. /**
  18. * 以下为调用示例
  19. * @param args
  20. */
  21. public static void main(String[] args) throws Exception {
  22. DefaultAcsClient client = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  23. try {
  24. // 设置审核安全IP
  25. SetAuditSecurityIpResponse response = setAuditSecurityIp(client);
  26. // 打印请求ID
  27. System.out.println("ResquestId:" + response.getRequestId());
  28. } catch (Exception e) {
  29. System.out.println("ErrorMessage:" + e.getLocalizedMessage());
  30. }
  31. }

获取审核安全IP列表

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

  1. import com.aliyuncs.vod.model.v20170321.ListAuditSecurityIpRequest;
  2. import com.aliyuncs.vod.model.v20170321.ListAuditSecurityIpResponse;
  3. /**
  4. * 设置审核安全IP
  5. */
  6. public static ListAuditSecurityIpResponse listAuditSecurityIp(DefaultAcsClient client) throws Exception {
  7. ListAuditSecurityIpRequest request = new ListAuditSecurityIpRequest();
  8. // 审核安全组名称
  9. request.setSecurityGroupName("MyGroupName");
  10. // 返回结果
  11. return client.getAcsResponse(request);
  12. }
  13. /**
  14. * 以下为调用示例
  15. * @param args
  16. */
  17. public static void main(String[] args) throws Exception {
  18. DefaultAcsClient client = initVodClient("<Your AccessKeyId>", "<Your AccessKeySecret>");
  19. try {
  20. // 获取审核安全IP列表
  21. ListAuditSecurityIpResponse response = listAuditSecurityIp(client);
  22. // 打印请求ID
  23. System.out.println("ResquestId:" + response.getRequestId());
  24. // 打印审核安全IP详情
  25. System.out.println("SecurityIpList:" + response.getSecurityIpList().toString());
  26. } catch (Exception e) {
  27. System.out.println("ErrorMessage:" + e.getLocalizedMessage());
  28. }
  29. }