Content moderation
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.
Usage notes
-
All examples in this topic use an AccessKey pair to initialize a client instance.
-
For request and response parameter details, visit Alibaba Cloud OpenAPI Explorer and open the API Documentations tab.
-
For SDK examples of other API operations, visit Alibaba Cloud OpenAPI Explorer. On the Parameters tab, specify the parameters and initiate the call. Then select the SDK version and language on the SDK Sample Code tab to view and download the code.
-
The examples in this topic use SDK V1.0. For V2.0 examples, select the correct SDK version in OpenAPI Explorer.
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.
Call the SubmitAIMediaAuditJob operation in 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: GetMediaAuditResultTimeline or .
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.
Alibaba Cloud OpenAPI Portal: ListAuditSecurityIp.
References
-
Content moderation: Provides detailed information about the content moderation feature of ApsaraVideo VOD, including its features, scenarios, and pricing.
-
Content Moderation Management: Provides complete SDK sample code for content moderation.