使用 Zend/PHP 删除 YouTube 视频 [英] Deleting YouTube videos using Zend/PHP

查看:21
本文介绍了使用 Zend/PHP 删除 YouTube 视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Zend 和 PHP 从我的主页上传和删除视频.上传部分工作正常,但下载更复杂.

I'm using Zend and PHP to upload and delete videos from my home page. The uploading part is working fine but to download is more complicated.

$videoEntryToDelete = $yt->getVideoEntry($videoId);
$yt->delete($videoEntryToDelete);

我使用此代码删除视频,第一行确实有效.视频对象已创建,我可以从中获取所有数据.但是当我尝试删除它时,我收到此错误消息:您必须指定要发布的 URI"

I use this code to delete a video and the first row do work. The video object is created and I can get all data from it. But when I try to delete it I get this error message: "You must specify an URI to which to post"

有人知道如何解决这个问题吗?

Do anyone know how to solve this problem?

谢谢!

推荐答案

默认情况下,getVideoEntry() 获取只读视频对象.为了编辑它,您必须在 getVideoEntry() 的第三个参数中传递 true.然后,视频对象将包含所有元数据,包括删除它所需的 URL.

By default, getVideoEntry() gets a read only video object. In order to edit it, you must pass true in the third parameter for getVideoEntry(). The video object will then contain all of the metadata, including the URL required to delete it.

试试这个:

$videoEntryToDelete = $yt->getVideoEntry($videoId, null, true);
$yt->delete($videoEntryToDelete);

这篇关于使用 Zend/PHP 删除 YouTube 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆