How to Retrieve Youtube Video Description Using Youtube API using Gdata?

950 Views Asked by At

I used YouTube video upload API to upload video from my site to YouTube, however I also need to retrieve video description of a video providing its url. I used this line

<?php $entry= getVideoEntry("kNUBV9trDoA"); echo $entry->getVideoDescription();?>

I used require zend loader to operate those line like

include("Zend/Loader.php");

but when i do this and run the PHP file on server i get this error

Fatal error: Call to undefined function getVideoEntry()

i believe the loader file load every file needed to operate

but in operation.php there are also these lines

Zend_Loader::loadClass('Zend_Gdata_YouTube');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_App_Exception');

but when i use those lines under loader include line i get this error

Warning: include_once(Zend\Gdata\YouTube.php) [function.include-once]: failed to open stream: No such file or directory in

they are all in that folder but the php script could not load them the path are all correct I've already checked .

How should i retrieve Video description of a YouTube video using this API what file do i need to require how do i initialize or are there any easier way to retrieve video description by providing URL or video id of YouTube

Regards

1

There are 1 best solutions below

0
On BEST ANSWER

You are not getting you video entry correctly. It should be:

// Assuming $yt is an authorised Zend_Gdata_YouTube object.
$entry       = $yt->getVideoEntry($videoid);
// Sometimes you may need to get the full entry:
$fullentry   = $yt->getFullVideoEntry($videoid);
// Now you can get the description
$description = $entry->getVideoDescription();

Have a read up on the Retrieving of the documentation.