Content moderation

Updated at:
Copy as MD

ApsaraVideo VOD content moderation detects risks such as terrorism, political content, pornography, advertisements, abusive language, and undesirable scenes in video, audio, image, and text resources. This topic provides Python SDK examples for submitting automated and manual review jobs and retrieving review results.

Limits

The automated review feature is supported only in the Singapore region.

Usage notes

  • All sample API calls in this topic use an AccessKey to initialize a client instance.

  • For detailed information about the request and response parameters of these API operations, visit the Alibaba Cloud OpenAPI Explorer. On the API operation page, open the API Documentations tab on the right side.

  • This topic provides examples for selected API operations. To obtain SDK code examples for other API operations, go to the Alibaba Cloud OpenAPI Explorer. On the Parameters tab, specify the required parameters and initiate the call. Then, on the SDK Sample Code tab, select the SDK version and your target language to view and download the sample code.

  • The examples in this topic use V1.0 of the SDK. To obtain examples for V2.0, make sure to select the correct SDK version in the Alibaba Cloud OpenAPI Explorer.image.png

Initialize a client

Before you use the SDK, initialize a client as described in Initialization.

Submit an automated review job

Call the SubmitAIMediaAuditJob operation to submit an automated review job.

You can call the SubmitAIMediaAuditJob operation in the Alibaba Cloud OpenAPI portal.

Query an automated review job

Call the GetAIMediaAuditJob operation to query automated review job details.

Alibaba Cloud OpenAPI Portal: GetAIMediaAuditJob.

Query automated review results

Call the GetMediaAuditResult operation to query automated review results.

Alibaba Cloud OpenAPI Portal: GetMediaAuditResult.

Query automated review result details

Call the GetMediaAuditResultDetail operation to query detailed automated review results.

For more information, see GetMediaAuditResultDetail in the Alibaba Cloud OpenAPI Portal.

Query the automated review timeline

Call the GetMediaAuditResultTimeline operation to query the timeline of automated review results.

Alibaba Cloud OpenAPI Portal URL: or GetMediaAuditResultTimeline.

Create a manual review

Call the CreateAudit operation to create a manual review job.

Alibaba Cloud OpenAPI Portal: CreateAuditRequest

Sample code:

from aliyunsdkvod.request.v20170321 import CreateAuditRequest
def create_audit(clt):
    request = CreateAuditRequest.CreateAuditRequest()

    auditContent = []
    # Specify the video ID, review status, and review description.
    auditItem = {'VideoId': '<videoId>', 'Status': 'Blocked', 'Reason': 'porn video'}
    auditContent.append(auditItem)
    request.set_AuditContent(json.dumps(auditContent))

    request.set_accept_format('JSON')
    response = json.loads(clt.do_action_with_exception(request))
    return response

try:
    clt = init_vod_client()
    res = create_audit(clt)
    print(json.dumps(res, ensure_ascii=False, indent=4))

except Exception as e:
    print(e)
    print(traceback.format_exc())

Query manual review history

Call the GetAuditHistory operation to query manual review history.

Alibaba Cloud OpenAPI Portal: GetAuditHistory.

Configure review security group IP addresses

Call the SetAuditSecurityIp operation to configure review security group IP addresses.

Alibaba Cloud OpenAPI Portal: SetAuditSecurityIp.

Query review security group IP addresses

Call the ListAuditSecurityIp operation to list review security group IP addresses.

You can find the API reference in the Alibaba Cloud OpenAPI Portal: ListAuditSecurityIp.