Help Center/
Content Moderation/
SDK Reference/
Using the Go SDK/
SDK Calling Example/
Moderation (Video)/
Creating a Video Moderation Job
Updated on 2023-07-17 GMT+08:00
Creating a Video Moderation Job
- This section describes how to create a video moderation job using the video moderation SDK and AK/SK.
Replace the AK/SK in the sample code with the actual AK/SK. You can use the withUrls method of the RunCreateVideoModerationJobRequest class to configure the URLs of the videos to be reviewed, and then execute the code.
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" moderation "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/moderation/v3/region" ) func main() { //Enter your AK/SK. ak := "<YOUR AK>" sk := "<YOUR SK>" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := moderation.NewModerationClient( moderation.ModerationClientBuilder(). WithRegion(region.ValueOf("xxx")). //Replace xxx with the region where the service is located. WithCredential(auth). Build()) request := &model.RunCreateVideoModerationJobRequest{} var listAudioCategoriesbody = []model.VideoCreateRequestAudioCategories{ model.GetVideoCreateRequestAudioCategoriesEnum().PORN, } var listImageCategoriesbody = []model.VideoCreateRequestImageCategories{ model.GetVideoCreateRequestImageCategoriesEnum().PORN, } frameIntervalData:= float32(5.5) databody := &model.VideoCreateRequestData{ Url: "http://xxx.xx.xxxx", FrameInterval: &frameIntervalData, } callbackVideoCreateRequest:= "http://xxx.xx.xxxx" request.Body = &model.VideoCreateRequest{ Callback: &callbackVideoCreateRequest, AudioCategories: &listAudioCategoriesbody, ImageCategories: listImageCategoriesbody, EventType: model.GetVideoCreateRequestEventTypeEnum().DEFAULT, Data: databody, } response, err := client.RunCreateVideoModerationJob(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
- The console returns the creation result of the video moderation job.
RunCreateVideoModerationJobResponse{"request_id":"dbbcb75d1a174bfa899a38be38fdd107", "job_id": "xxx"}
Parent topic: Moderation (Video)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot