Youtube api 我如何过滤YouTube Data API v3中因版权原因而被阻止的视频

Youtube api 我如何过滤YouTube Data API v3中因版权原因而被阻止的视频,youtube-api,youtube-data-api,Youtube Api,Youtube Data Api,这是我的密码 $videosResponse = $youtube->videos->listVideos('status, fileDetails, snippet, recordingDetails, topicDetails', array( 'id' => $id, 'maxResults' => 1,

这是我的密码

$videosResponse = $youtube->videos->listVideos('status, fileDetails, snippet, recordingDetails, topicDetails', array(
                            'id' => $id,
                            'maxResults' => 1,
                            'part' => 'status,snippet',
                          ));
以下是回应

object(Google_Service_YouTube_VideoListResponse)#73 (16) {
          ["collection_key":protected]=>
          string(5) "items"
          ["internal_gapi_mappings":protected]=>
          array(0) {
          }
          ["etag"]=>
          string(57) ""fpJ9onbY0Rl_LqYLG6rOCJ9h9N8/lnLk97dQDMUpWh4EJfvVHiKXvG8""
          ["eventId"]=>
          NULL
          ["itemsType":protected]=>
          string(28) "Google_Service_YouTube_Video"
          ["itemsDataType":protected]=>
          string(5) "array"
          ["kind"]=>
          string(25) "youtube#videoListResponse"
          ["nextPageToken"]=>
          NULL
          ["pageInfoType":protected]=>
          string(31) "Google_Service_YouTube_PageInfo"
          ["pageInfoDataType":protected]=>
          string(0) ""
          ["prevPageToken"]=>
          NULL
          ["tokenPaginationType":protected]=>
          string(38) "Google_Service_YouTube_TokenPagination"
          ["tokenPaginationDataType":protected]=>
          string(0) ""
          ["visitorId"]=>
          NULL
          ["modelData":protected]=>
          array(2) {
            ["pageInfo"]=>
            array(2) {
              ["totalResults"]=>
              int(1)
              ["resultsPerPage"]=>
              int(1)
            }
            ["items"]=>
            array(1) {
              [0]=>
              array(5) {
                ["kind"]=>
                string(13) "youtube#video"
                ["etag"]=>
                string(57) ""fpJ9onbY0Rl_LqYLG6rOCJ9h9N8/NCacXkm79gLd-LDp1PS5m7Z_FFc""
                ["id"]=>
                string(11) "bdzxVW3zlZ0"
                ["snippet"]=>
                array(10) {
                  ["publishedAt"]=>
                  string(24) "2011-11-10T07:13:44.000Z"
                  ["channelId"]=>
                  string(24) "UColEueTkpUJjnDlaO-P14DQ"
                  ["title"]=>
                  string(32) "Leap of Faith Movie_Steve Martin"
                  ["description"]=>
                  string(82) "I created this video with the YouTube Video Editor (http://www.youtube.com/editor)"
                  ["thumbnails"]=>
                  array(4) {
                    ["default"]=>
                    array(3) {
                      ["url"]=>
                      string(46) "https://i.ytimg.com/vi/bdzxVW3zlZ0/default.jpg"
                      ["width"]=>
                      int(120)
                      ["height"]=>
                      int(90)
                    }
                    ["medium"]=>
                    array(3) {
                      ["url"]=>
                      string(48) "https://i.ytimg.com/vi/bdzxVW3zlZ0/mqdefault.jpg"
                      ["width"]=>
                      int(320)
                      ["height"]=>
                      int(180)
                    }
                    ["high"]=>
                    array(3) {
                      ["url"]=>
                      string(48) "https://i.ytimg.com/vi/bdzxVW3zlZ0/hqdefault.jpg"
                      ["width"]=>
                      int(480)
                      ["height"]=>
                      int(360)
                    }
                    ["standard"]=>
                    array(3) {
                      ["url"]=>
                      string(48) "https://i.ytimg.com/vi/bdzxVW3zlZ0/sddefault.jpg"
                      ["width"]=>
                      int(640)
                      ["height"]=>
                      int(480)
                    }
                  }
                  ["channelTitle"]=>
                  string(10) "nenbanogon"
                  ["tags"]=>
                  array(1) {
                    [0]=>
                    string(14) "YouTube editor"
                  }
                  ["categoryId"]=>
                  string(2) "24"
                  ["liveBroadcastContent"]=>
                  string(4) "none"
                  ["localized"]=>
                  array(2) {
                    ["title"]=>
                    string(32) "Leap of Faith Movie_Steve Martin"
                    ["description"]=>
                    string(82) "I created this video with the YouTube Video Editor (http://www.youtube.com/editor)"
                  }
                }
                ["status"]=>
                array(5) {
                  ["uploadStatus"]=>
                  string(9) "processed"
                  ["privacyStatus"]=>
                  string(6) "public"
                  ["license"]=>
                  string(7) "youtube"
                  ["embeddable"]=>
                  bool(true)
                  ["publicStatsViewable"]=>
                  bool(true)
                }
              }
            }
          }
          ["processed":protected]=>
          array(0) {
          }
        }
在响应对象中有一个“状态”数组,我可以在其中过滤私人和不可嵌入的视频

    ["status"]=>
    array(5) {
      ["uploadStatus"]=>
      string(9) "processed"
      ["privacyStatus"]=>
      string(6) "public"
      ["license"]=>
      string(7) "youtube"
      ["embeddable"]=>
      bool(true)
      ["publicStatsViewable"]=>
      bool(true)
    }
但我不能过滤因版权原因被屏蔽的视频


这里有一个类似的问题

您可以根据属性进行筛选

请尝试使用safeSearch

$videosResponse = $youtube->videos->listVideos('status, fileDetails, snippet, recordingDetails, topicDetails', array(
                        'id' => $id,
                        'maxResults' => 1,
                        'part' => 'status,snippet',
                        'safeSearch' => 'strict',
                      ));

你想在哪里过滤?客户端还是服务器?我试着在服务器端过滤它。使用此文档,但找不到执行此操作的方法。服务器端代码是什么语言?PHP?是的,我使用PHP Yii框架