All Products
Search
Document Center

ApsaraVideo VOD:Content moderation

Last Updated:Aug 22, 2023

This topic provides examples on how to call the API operations of the content moderation module. The API operations are encapsulated in ApsaraVideo VOD SDK for Python. You can call the API operations to submit and query automated review jobs. You can also query automated review results, create manual review jobs, and configure IP addresses in review security groups.

Limits

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

Usage notes

  • In this example, an AccessKey pair is used to initialize a client instance.

  • For more information about the request and response parameters of this operation, visit OpenAPI Explorer. You can click API Documentation in the top navigation bar to view information related to the API operation.

  • This topic provides sample code only for some complex API operations. To obtain sample code for other API operations, perform the following operations: Visit Alibaba Cloud OpenAPI Explorer. In the left-side navigation pane, find the API operation whose sample code you want to obtain and specify the required parameters on the Parameters tab. Then, click Initiate Call. On the SDK Sample Code tab, select the language to view and download the sample code.

Initialize a client

Before you use the SDK, initialize a client. For more information, see Initialization.

Submit an automated review job

You can call the SubmitAIMediaAuditJob operation to submit an automated review job.

Click SubmitAIMediaAuditJob to learn more about this API operation.

Query an automated review job

You can call the GetAIMediaAuditJob operation to query details about an automated review job.

Click GetAIMediaAuditJob to learn more about this API operation.

Query automated review results

You can call the GetMediaAuditResult operation to query the results of automated review jobs.

Click GetAIMediaAuditResult to learn more about this API operation.

Query details of automated review results

You can call the GetMediaAuditResultDetail operation to query details of automated review results.

Click GetMediaAuditResultDetail to learn more about this API operation.

Query the timeline of automated review results

You can call the GetMediaAuditResultTimeline operation to query the timeline of automated review results.

Click GetMediaAuditResultTimeline to learn more about this API operation.

Create a manual review job

You can call the CreateAudit operation to create a manual review job.

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 historical manual review jobs

You can call the GetAuditHistory operation to query historical manual review jobs.

Configure IP addresses in review security groups

You can call the SetAuditSecurityIp operation to manage the IP addresses in a security group.

Query IP addresses in review security groups

You can call the ListAuditSecurityIp operation to query the IP addresses in a security group.