All Products
Search
Document Center

Media content moderation

Last Updated: May 27, 2020

Initialize a client

Initialize a client before using the SDK. For more information, see initVodClient.

Submit an automated review job

  1. // Call example
  2. var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');
  3. client.request("SubmitAIMediaAuditJob", {
  4. MediaId: 'xxxxxxa507a44d0eaa7424afdxxxxxx' // Sets the media asset ID.
  5. }, {}).then(function (response) {
  6. console.log('JobId = ' + response.JobId); // The job ID.
  7. console.log('MediaId = ' + response.MediaId); // The video ID.
  8. console.log('RequestId = ' + response.RequestId);
  9. }).catch(function (response) {
  10. console.log('ErrorCode = ' + response.data.Code);
  11. console.log('ErrorMessage = ' + response.data.Message);
  12. console.log('RequestId = ' + response.data.RequestId);
  13. });

Query an automated review job

  1. // Call example
  2. var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');
  3. client.request("GetAIMediaAuditJob", {
  4. JobId: 'xxxxxxde1dd8492ea6d815f079xxxxxx' // Sets the job ID.
  5. }, {}).then(function (response) {
  6. if (response.MediaAuditJob){
  7. // The job result.
  8. console.log('MediaId = ' + response.MediaAuditJob.MediaId);
  9. console.log('JobId = ' + response.MediaAuditJob.JobId);
  10. console.log('Type = ' + response.MediaAuditJob.Type);
  11. console.log('Status = ' + response.MediaAuditJob.Status);
  12. if (response.MediaAuditJob.Code){
  13. console.log('Code = ' + response.MediaAuditJob.Code);
  14. }
  15. if (response.MediaAuditJob.Message){
  16. console.log('Message = ' + response.MediaAuditJob.Message);
  17. }
  18. if (response.MediaAuditJob.Data){
  19. console.log('Data Label = ' + response.MediaAuditJob.Data.Label);
  20. console.log('Data Suggestion = ' + response.MediaAuditJob.Data.Suggestion);
  21. console.log('Data AbnormalModules = ' + response.MediaAuditJob.Data.AbnormalModules);
  22. }
  23. }
  24. console.log('RequestId = ' + response.RequestId);
  25. }).catch(function (response) {
  26. console.log('ErrorCode = ' + response.data.Code);
  27. console.log('ErrorMessage = ' + response.data.Message);
  28. console.log('RequestId = ' + response.data.RequestId);
  29. });

Obtain the summary of the automated review result

  1. // Call example
  2. var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');
  3. client.request("GetMediaAuditResult", {
  4. MediaId: 'xxxxxxea743d4733adfc8c3654xxxxxx' // Sets the media asset ID.
  5. }, {}).then(function (response) {
  6. console.log(response);
  7. if (response.MediaAuditResult){
  8. // The summary of the automated review result.
  9. console.log('Data Label = ' + response.MediaAuditResult.Label);
  10. console.log('Data Suggestion = ' + response.MediaAuditResult.Suggestion);
  11. console.log('Data AbnormalModules = ' + response.MediaAuditResult.AbnormalModules);
  12. }
  13. console.log('RequestId = ' + response.RequestId);
  14. }).catch(function (response) {
  15. console.log('ErrorCode = ' + response.data.Code);
  16. console.log('ErrorMessage = ' + response.data.Message);
  17. console.log('RequestId = ' + response.data.RequestId);
  18. });

Obtain the details about the automated review result

  1. // Call example
  2. var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');
  3. client.request("GetMediaAuditResultDetail", {
  4. MediaId: 'xxxxxxea743d4733adfc8c3654xxxxxx', // Sets the media asset ID.
  5. PageNo: 1
  6. }, {}).then(function (response) {
  7. if (response.MediaAuditResultDetail){
  8. // The details about the automated review result.
  9. console.log('Data Total = ' + response.MediaAuditResultDetail.Total);
  10. console.log('Data List Size = ' + response.MediaAuditResultDetail.List.length);
  11. }
  12. console.log('RequestId = ' + response.RequestId);
  13. }).catch(function (response) {
  14. console.log('ErrorCode = ' + response.data.Code);
  15. console.log('ErrorMessage = ' + response.data.Message);
  16. console.log('RequestId = ' + response.data.RequestId);
  17. });

Obtain the timeline of the automated review result

  1. // Call example
  2. var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');
  3. client.request("GetMediaAuditResultTimeline", {
  4. MediaId: 'xxxxxxea743d4733adfc8c3654xxxxxx' // Sets the media asset ID.
  5. }, {}).then(function (response) {
  6. if (response.MediaAuditResultTimeline){
  7. // The timeline of the automated review result.
  8. if (response.MediaAuditResultTimeline.Terrorism){
  9. console.log('Terrorism = ' + response.MediaAuditResultTimeline.Terrorism);
  10. }
  11. if (response.MediaAuditResultTimeline.Porn){
  12. console.log('Porn = ' + response.MediaAuditResultTimeline.Porn);
  13. }
  14. }
  15. console.log('RequestId = ' + response.RequestId);
  16. }).catch(function (response) {
  17. console.log('ErrorCode = ' + response.data.Code);
  18. console.log('ErrorMessage = ' + response.data.Message);
  19. console.log('RequestId = ' + response.data.RequestId);
  20. });

Start a manual review

For more information about the request and response parameters, see CreateAudit.

  1. // Call example
  2. var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');
  3. var auditContent = [{
  4. VideoId: 'VideoId', // Sets the video ID.
  5. Status: 'Blocked', // Sets the review status.
  6. Reason: 'porn video' // Specifies the reason for blocking the video if the Status parameter is set to Blocked. Length constraint: maximum length of 128 bytes.
  7. }];
  8. client.request("CreateAudit", {
  9. AuditContent: JSON.stringify(auditContent)
  10. }, {}).then(function (response) {
  11. console.log('RequestId = ' + response.RequestId);
  12. }).catch(function (response) {
  13. console.log('ErrorCode = ' + response.data.Code);
  14. console.log('ErrorMessage = ' + response.data.Message);
  15. console.log('RequestId = ' + response.data.RequestId);
  16. });

Obtain the manual review history

For more information about the request and response parameters, see GetAuditHistory.

  1. // Call example
  2. var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');
  3. client.request("GetAuditHistory", {
  4. VideoId: 'VideoId',
  5. PageNo: 1,
  6. PageSize: 10
  7. }, {}).then(function (response) {
  8. // The total number of records in the manual review history.
  9. console.log('Total = ' + response.Total);
  10. // The latest manual review result.
  11. console.log('Status = ' + response.Status);
  12. // The list of records in the manual review history.
  13. console.log('Histories = ');
  14. console.log(response.Histories);
  15. console.log('RequestId = ' + response.RequestId);
  16. }).catch(function (response) {
  17. console.log('ErrorCode = ' + response.data.Code);
  18. console.log('ErrorMessage = ' + response.data.Message);
  19. console.log('RequestId = ' + response.data.RequestId);
  20. });

Add IP addresses to review security groups

For more information about the request and response parameters, see SetAuditSecurityIp.

  1. // Call example
  2. var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');
  3. client.request("SetAuditSecurityIp", {
  4. SecurityGroupName: 'MyGroupName', // Sets the name of each review security group. Default value: Default.
  5. OperateMode: 'Cover', // Sets the write mode. The default value Append indicates that new IP addresses are appended to the whitelist.
  6. Ips: '10.23.12.20,10.23.12.21,10.23.12.22' // Sets the whitelist of IP addresses in each review security group. You can add a maximum of 100 IP addresses to each group. Separate multiple IP addresses with a comma (,).
  7. }, {}).then(function (response) {
  8. console.log('RequestId = ' + response.RequestId);
  9. }).catch(function (response) {
  10. console.log('ErrorCode = ' + response.data.Code);
  11. console.log('ErrorMessage = ' + response.data.Message);
  12. console.log('RequestId = ' + response.data.RequestId);
  13. });

Obtain a whitelist of IP addresses in review security groups

For more information about the request and response parameters, see ListAuditSecurityIp.

  1. // Call example
  2. var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');
  3. client.request("ListAuditSecurityIp", {
  4. SecurityGroupName: 'MyGroupName' // Sets the name of each review security group.
  5. }, {}).then(function (response) {
  6. // The whitelist of IP addresses in review security groups.
  7. console.log('SecurityIpList = ');
  8. console.log(response.SecurityIpList);
  9. console.log('RequestId = ' + response.RequestId);
  10. }).catch(function (response) {
  11. console.log('ErrorCode = ' + response.data.Code);
  12. console.log('ErrorMessage = ' + response.data.Message);
  13. console.log('RequestId = ' + response.data.RequestId);
  14. });