All Products
Search
Document Center

Media content moderation

Last Updated: Jul 11, 2019

Initialize a client

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

Submit an automated review job

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

// Call example
var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');

client.request("SubmitAIMediaAuditJob", {
    MediaId: 'xxxxxxa507a44d0eaa7424afdxxxxxx' // Sets the media asset ID.
}, {}).then(function (response) {
    console.log('JobId = ' + response.JobId); // The job ID.
    console.log('MediaId = ' + response.MediaId); // The video ID.
    console.log('RequestId = ' + response.RequestId);
}).catch(function (response) {
    console.log('ErrorCode = ' + response.data.Code);
    console.log('ErrorMessage = ' + response.data.Message);
    console.log('RequestId = ' + response.data.RequestId);
});

Query an automated review job

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

// Call example
var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');

client.request("GetAIMediaAuditJob", {
    JobId: 'xxxxxxde1dd8492ea6d815f079xxxxxx' // Sets the job ID.
}, {}).then(function (response) {
    if (response.MediaAuditJob){
        // The job result.
        console.log('MediaId = ' + response.MediaAuditJob.MediaId);
        console.log('JobId = ' + response.MediaAuditJob.JobId);
        console.log('Type = ' + response.MediaAuditJob.Type);
        console.log('Status = ' + response.MediaAuditJob.Status);
        if (response.MediaAuditJob.Code){
            console.log('Code = ' + response.MediaAuditJob.Code);
        }
        if (response.MediaAuditJob.Message){
            console.log('Message = ' + response.MediaAuditJob.Message);
        }
        if (response.MediaAuditJob.Data){
            console.log('Data Label = ' + response.MediaAuditJob.Data.Label);
            console.log('Data Suggestion = ' + response.MediaAuditJob.Data.Suggestion);
            console.log('Data AbnormalModules = ' + response.MediaAuditJob.Data.AbnormalModules);
        }
    }
    console.log('RequestId = ' + response.RequestId);
}).catch(function (response) {
    console.log('ErrorCode = ' + response.data.Code);
    console.log('ErrorMessage = ' + response.data.Message);
    console.log('RequestId = ' + response.data.RequestId);
});

Obtain the summary of the automated review result

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

// Call example
var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');

client.request("GetMediaAuditResult", {
    MediaId: 'xxxxxxea743d4733adfc8c3654xxxxxx' // Sets the media asset ID.
}, {}).then(function (response) {
    console.log(response);
    if (response.MediaAuditResult){
        // The summary of the automated review result.
        console.log('Data Label = ' + response.MediaAuditResult.Label);
        console.log('Data Suggestion = ' + response.MediaAuditResult.Suggestion);
        console.log('Data AbnormalModules = ' + response.MediaAuditResult.AbnormalModules);
    }
    console.log('RequestId = ' + response.RequestId);
}).catch(function (response) {
    console.log('ErrorCode = ' + response.data.Code);
    console.log('ErrorMessage = ' + response.data.Message);
    console.log('RequestId = ' + response.data.RequestId);
});

Obtain the details about the automated review result

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

// Call example
var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');

client.request("GetMediaAuditResultDetail", {
    MediaId: 'xxxxxxea743d4733adfc8c3654xxxxxx', // Sets the media asset ID.
    PageNo: 1
}, {}).then(function (response) {
    if (response.MediaAuditResultDetail){
        // The details about the automated review result.
        console.log('Data Total = ' + response.MediaAuditResultDetail.Total);
        console.log('Data List Size = ' + response.MediaAuditResultDetail.List.length);
    }
    console.log('RequestId = ' + response.RequestId);
}).catch(function (response) {
    console.log('ErrorCode = ' + response.data.Code);
    console.log('ErrorMessage = ' + response.data.Message);
    console.log('RequestId = ' + response.data.RequestId);
});

Obtain the timeline of the automated review result

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

// Call example
var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');

client.request("GetMediaAuditResultTimeline", {
    MediaId: 'xxxxxxea743d4733adfc8c3654xxxxxx' // Sets the media asset ID.
}, {}).then(function (response) {
    if (response.MediaAuditResultTimeline){
        // The timeline of the automated review result.
        if (response.MediaAuditResultTimeline.Terrorism){
            console.log('Terrorism = ' + response.MediaAuditResultTimeline.Terrorism);
        }
        if (response.MediaAuditResultTimeline.Porn){
            console.log('Porn = ' + response.MediaAuditResultTimeline.Porn);
        }
    }
    console.log('RequestId = ' + response.RequestId);
}).catch(function (response) {
    console.log('ErrorCode = ' + response.data.Code);
    console.log('ErrorMessage = ' + response.data.Message);
    console.log('RequestId = ' + response.data.RequestId);
});

Start a manual review

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

// Call example
var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');

var auditContent = [{
    VideoId: 'VideoId', // Sets the video ID.
    Status: 'Blocked', // Sets the review status.
    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.
}];
client.request("CreateAudit", {
    AuditContent: JSON.stringify(auditContent)
}, {}).then(function (response) {
    console.log('RequestId = ' + response.RequestId);
}).catch(function (response) {
    console.log('ErrorCode = ' + response.data.Code);
    console.log('ErrorMessage = ' + response.data.Message);
    console.log('RequestId = ' + response.data.RequestId);
});

Obtain the manual review history

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

// Call example
var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');

client.request("GetAuditHistory", {
    VideoId: 'VideoId',
    PageNo: 1,
    PageSize: 10
}, {}).then(function (response) {
    // The total number of records in the manual review history.
    console.log('Total = ' + response.Total);
    // The latest manual review result.
    console.log('Status = ' + response.Status);
    // The list of records in the manual review history.
    console.log('Histories = ');
    console.log(response.Histories);
    console.log('RequestId = ' + response.RequestId);
}).catch(function (response) {
    console.log('ErrorCode = ' + response.data.Code);
    console.log('ErrorMessage = ' + response.data.Message);
    console.log('RequestId = ' + response.data.RequestId);
});

Add IP addresses to review security groups

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

// Call example
var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');

client.request("SetAuditSecurityIp", {
    SecurityGroupName: 'MyGroupName', // Sets the name of each review security group. Default value: Default.
    OperateMode: 'Cover', // Sets the write mode. The default value Append indicates that new IP addresses are appended to the whitelist.
    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 (,).
}, {}).then(function (response) {
    console.log('RequestId = ' + response.RequestId);
}).catch(function (response) {
    console.log('ErrorCode = ' + response.data.Code);
    console.log('ErrorMessage = ' + response.data.Message);
    console.log('RequestId = ' + response.data.RequestId);
});

Obtain a whitelist of IP addresses in review security groups

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

// Call example
var client = initVodClient('<Your AccessKey ID>','<Your AccessKey Secret>');

client.request("ListAuditSecurityIp", {
    SecurityGroupName: 'MyGroupName' // Sets the name of each review security group.
}, {}).then(function (response) {
    // The whitelist of IP addresses in review security groups.
    console.log('SecurityIpList = ');
    console.log(response.SecurityIpList);
    console.log('RequestId = ' + response.RequestId);
}).catch(function (response) {
    console.log('ErrorCode = ' + response.data.Code);
    console.log('ErrorMessage = ' + response.data.Message);
    console.log('RequestId = ' + response.data.RequestId);
});