No Description

censor_video.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. require_once __DIR__ . '/../autoload.php';
  3. use Qiniu\Auth;
  4. use Qiniu\Config;
  5. use Qiniu\Storage\ArgusManager;
  6. // 控制台获取密钥:https://portal.qiniu.com/user/key
  7. $accessKey = getenv('QINIU_ACCESS_KEY');
  8. $secretKey = getenv('QINIU_SECRET_KEY');
  9. $auth = new Auth($accessKey, $secretKey);
  10. $config = new Config();
  11. $argusManager = new ArgusManager($auth, $config);
  12. // 视频内容审核
  13. // 参考文档:https://developer.qiniu.com/censor/api/5620/video-censor
  14. $body = '{
  15. "data":{
  16. "uri":"https://dn-mars-assets.qbox.me/Fi1UC6waXtXYCpnTGHa8XxIziGNk"
  17. },
  18. "params":{
  19. "scenes":[
  20. "pulp",
  21. "terror",
  22. "politician",
  23. "ads"
  24. ]
  25. }
  26. }';
  27. list($jobid, $err) = $argusManager->censorVideo($body);
  28. echo "\n====> Result is: \n";
  29. if ($err !== null) {
  30. var_dump($err);
  31. } else {
  32. echo "job_id is: $jobid\n";
  33. }
  34. // 查询视频审核结果
  35. list($ret, $err) = $argusManager->censorStatus($jobid);
  36. echo "\n====> job status: \n";
  37. if ($err != null) {
  38. var_dump($err);
  39. } else {
  40. var_dump($ret);
  41. }