日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

媒資審核

通過閱讀本文,您可以了解通過服務端SDK調用OpenAPI審核智能媒體服務媒資信息的示例代碼。

示例代碼

您可以通過阿里云OpenAPI開發(fā)者門戶在線調試。

package com.aliyun.ice.sample;

import com.aliyun.ice20201109.Client;
import com.aliyun.ice20201109.models.*;
import com.aliyun.teaopenapi.models.Config;

public class Sample {

    public static void main(String[] args) throws Exception {

        // 阿里云賬號AccessKey擁有所有API的訪問權限,建議您使用RAM用戶進行API訪問或日常運維。
        // 本示例以將AccessKey ID和 AccessKey Secret保存在環(huán)境變量為例說明。
        com.aliyun.credentials.Client credentialClient = new com.aliyun.credentials.Client();
        Config config = new Config();
        config.setCredential(credentialClient);

        // 如需硬編碼AccessKey ID和AccessKey Secret,代碼如下,但強烈建議不要把AccessKey ID和AccessKey Secret保存到工程代碼里,否則可能導致AccessKey泄露,威脅您賬號下所有資源的安全。
        // config.accessKeyId = <yourAccessKeyId>;
        // config.accessKeySecret = <yourAccessKeySecret>;

        config.endpoint = "ice.cn-shanghai.aliyuncs.com";
        Client client = new Client(config);

        // 創(chuàng)建審核模板
        String censorTemplateConfig = "{\"Scene\":[\"porn\",\"terrorism\"],\"Scope\":[\"title\",\"video\",\"audio\",\"cover\"]}";
        CreateCustomTemplateRequest createCustomTemplateRequest = new CreateCustomTemplateRequest()
            .setName("sdk_sample_censor_template")
            .setType(7)
            .setSubtype(1)
            .setTemplateConfig(censorTemplateConfig);
        CreateCustomTemplateResponse createCustomTemplateResponse = client.createCustomTemplate(createCustomTemplateRequest);
        String templateId = createCustomTemplateResponse.getBody().getCustomTemplate().getTemplateId();
        System.out.println("template id: " + templateId);

        // 提交媒體審核任務
        SubmitMediaCensorJobRequest submitMediaCensorJobRequest = new SubmitMediaCensorJobRequest()
            .setInput(new SubmitMediaCensorJobRequest.SubmitMediaCensorJobRequestInput()
                      .setType("Media")
                      .setMedia("3945e42d01823498****"))
            .setOutput("oss://testbucket/censor/snapshot-{Count}.jpg")
            .setTemplateId(templateId);
        SubmitMediaCensorJobResponse submitMediaCensorJobResponse = client.submitMediaCensorJob(submitMediaCensorJobRequest);
        String jobId = submitMediaCensorJobResponse.getBody().getJobId();
        System.out.println("job id: " + jobId);

        // 查詢審核任務詳細信息
        QueryMediaCensorJobDetailRequest queryMediaCensorJobDetailRequest = new QueryMediaCensorJobDetailRequest()
            .setJobId(jobId);
        QueryMediaCensorJobDetailResponse queryMediaCensorJobDetailResponse = client.queryMediaCensorJobDetail(queryMediaCensorJobDetailRequest);
        System.out.println("request id: " + queryMediaCensorJobDetailResponse.getBody().getRequestId());

        // 查詢媒體審核任務作業(yè)列表
        QueryMediaCensorJobListRequest queryMediaCensorJobListRequest = new QueryMediaCensorJobListRequest()
            .setJobIds(jobId);
        QueryMediaCensorJobListResponse queryMediaCensorJobListResponse = client.queryMediaCensorJobList(queryMediaCensorJobListRequest);
        System.out.println("request id: " + queryMediaCensorJobListResponse.getBody().getRequestId());
    }
}

相關接口