tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Webpage Moderation

PDF
Focus Mode
Font Size
Last updated: 2024-02-02 12:12:58

Overview

This document describes how to use the content moderation feature provided by Cloud Infinite (CI). CI fully integrates the processing capabilities with the COS SDK.
Note:
To use the content moderation service, you need to have the permission to use CI:
For root accounts, click here for role authorization.
This document provides an overview of APIs and SDK code samples for webpage moderation.
API
Description
Submits webpage moderation job.
Queries the result of specified webpage moderation job.

Submitting Webpage Moderation Job

Feature description

This API is used to submit a webpage moderation job.

Method prototype

CosResult CosAPI::CreateWebPageAuditingJob(const CreateWebPageAuditingJobReq& req, CreateWebPageAuditingJobResp* resp);

Sample request

qcloud_cos::CosConfig config("./config.json");
qcloud_cos::CosAPI cos(config);
std::string bucket_name = "examplebucket-1250000000";
std::string url = "http://test.com";

CreateWebPageAuditingJobReq req(bucket_name);
CreateWebPageAuditingJobResp resp;

// Add request parameters as detailed in the API documentation
req.SetUrl(url);
req.SetDetectType("Porn,Ads");

// Call the API to get the job response object
CosResult result = cos.CreateWebPageAuditingJob(req, &resp);
if (result.IsSucc()) {
// If the moderation job is created successfully, you can call the member functions of `CreateWebPageAuditingJobResp`.
} else {
// If the moderation job failed to be created, you can call the member functions of `CosResult` to output the error message.
}

Parameter description

Parameter
Description
Type
Required
req
CreateWebPageAuditing operation request
CreateWebPageAuditingJobReq
Yes
resp
CreateWebPageAuditing operation response
CreateWebPageAuditingJobResp
Yes
CreateWebPageAuditingJobReq provides the following member functions:
// Set the bucket for performing the operation
void SetBucketName(const std::string& bucket_name);
// Set the input video to be moderated
void SetInput(const AuditingInput& input);
// Set moderation configuration rules
void SetConf(const Conf& conf);

// conf
// The scene to be moderated, such as `Porn` (pornography) and `Ads` (advertising). You can pass in multiple types and separate them by comma, such as `Porn,Ads`.
void SetDetectType(const std::string& detect_type);
// Callback address, which must start with `http://` or `https://`.
void SetCallBack(const std::string& callback);
// Specify whether to highlight the non-compliant text on the webpage. When the result is queried or called back, this parameter decides whether to return the highlighted HTML content. Valid values: `true`, `false`. Default value: `false`.
void SetReturnHighligthHtml(const bool return_highlight_html);


// input
// Full URL of the webpage, such as `http://www.test.com`.
void SetUrl(const std::string& url);
// This field will return the original content in the moderation result, which can contain up to 512 bytes. You can use this field to uniquely identify the data to be moderated in your business.
void SetDataId(const std::string& data_id);
// Business field.
void SetUserInfo(const UserInfo& user_info);
CreateWebPageAuditingJobResp provides the following member functions:
// Get the job details returned by the API request
WebPageAuditingJobsDetail GetJobsDetail();
// Get the `RequestId` returned by the API
std::string GetRequestId();


Response description

Success: The moderation job result in the XML content returned by the API will be parsed into the WebPageAuditingJobsDetail structure. For specific response parameters, see Submitting Webpage Moderation Job.
Failure: If an error (for example, the bucket does not exist) occurs, the error message will be parsed into the CosResult structure. For more information, see Troubleshooting.

Querying Webpage Moderation Job Result

Feature description

This API is used to query the status and result of a webpage moderation job.

Method prototype

CosResult DescribeWebPageAuditingJob(const DescribeWebPageAuditingJobReq& req, DescribeWebPageAuditingJobResp* resp);

Sample request

qcloud_cos::CosConfig config("./config.json");
qcloud_cos::CosAPI cos(config);
std::string bucket_name = "examplebucket-1250000000";

DescribeWebPageAuditingJobReq req(bucket_name);
DescribeWebPageAuditingJobResp resp;

// Add request parameters as detailed in the API documentation
req.SetJobId("aab1ca9fc8a3ed11ea834c525400863904");

// Call the API to get the job response object
CosResult result = cos.DescribeWebPageAuditingJob(req, &resp);
if (result.IsSucc()) {
// If the moderation job is queried successfully, you can call the member functions of `DescribeWebPageAuditingJobResp`.
} else {
// If the moderation job failed to be queried, you can call the member functions of `CosResult` to output the error message.
}

Parameter description

Parameter
Description
Type
Required
req
DescribeWebPageAuditingJob operation request
DescribeWebPageAuditingJobReq
Yes
resp
DescribeWebPageAuditingJob operation response
DescribeWebPageAuditingJobResp
Yes
DescribeWebPageAuditingJobReq provides the following member functions:
// Set the bucket for performing the operation
void SetBucketName(const std::string& bucket_name);
// Set the ID of the moderation job to be queried
void SetJobId(const std::string& job_id);
DescribeWebPageAuditingJobResp provides the following member functions:
// Get the job details returned by the API request
WebPageAuditingJobsDetail GetJobsDetail();
// Get the `RequestId` returned by the API
std::string GetRequestId();


Response description

Success: The moderation job result in the XML content returned by the API will be parsed into the WebPageAuditingJobsDetail structure. For specific response parameters, see Querying Webpage Moderation Job Result.
Failure: If an error (for example, the bucket does not exist) occurs, the error message will be parsed into the CosResult structure. For more information, see Troubleshooting.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback