Delete YouTube videos using Zend / PHP

I use Zend and PHP to download and delete videos from my homepage. The download part works fine, but the download is more complicated.

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

I use this code to delete a video and the first line works. A video object is created, and I can get all the data from it. But when I try to delete it, I get this error message: "You must specify the URI to which the message should be sent

Does anyone know how to solve this problem?

Thanks!

+4
source share
2 answers

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

Try the following:

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

There is also a ready-to-use method:

 $videoEntryToDelete = $yt->getFullVideoEntry($videoId); $yt->delete($videoEntryToDelete); 
+2
source

Source: https://habr.com/ru/post/1304897/


All Articles