我正在尝试使用客户端库 v3 将视频上传到 youtube。
v3 库是实验性的,没有太多文档
(提供的示例不包括 youtube)
我已经使用 oauth 2.0 正确验证了用户身份。当我拥有访问令牌时,我正在尝试使用此代码。
if ($client->getAccessToken()) {
$snippet = new Google_VideoSnippet();
$snippet -> setTitle = "Demo title";
$snippet -> setDescriptio = "Demo descrition";
$snippet -> setTags = array("tag1","tag2");
$snippet -> setMimeType = 'video/quicktime';
$video = new Google_Video();
$video -> setSnippet($snippet);
// Not sure what to do now....
$_SESSION['access_token'] = $client->getAccessToken();
}
来自docs https://developers.google.com/youtube/v3/docs/videos/insert,
我需要提供一个part范围
The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include.
The part names that you can include in the parameter value are snippet, contentDetails, player, statistics, status, and topicDetails. However, not all of those parts contain properties that can be set when setting or updating a video's metadata. For example, the statistics object encapsulates statistics that YouTube calculates for a video and does not contain values that you can set or modify. If the parameter value specifies a part that does not contain mutable values, that part will still be included in the API response.
但除了我无法理解的 python 示例之外,它缺少文档。
(该示例位于链接底部,我提供)
请不要提供 zend 库的示例/链接,它使用我不想要的 auth-sub 。
我想使用oauth 2.0。