List Info

Thread: youtube and 503 errors




youtube and 503 errors
user name
2008-03-26 10:29:34
Hi, 

I've got a script which gets me a video id using gdata and
works fine.  I
then use the code in an embedded video link.

The problem I've got is every so often (and it can be quite
frequent) I get
an a 503 response from youtube which results in a fatal
error and stops the
rest of my page loading.

What I'd like to do is catch the 503 error and then display
a message like
"Sorry - video not available" instead of the fatal
error message.

I guess I can use the zend_http_response but I can't for the
life of me
figure out how to do it properly.

My code for retrieval of the code is: 
require_once 'Zend/Loader.php';
require_once 'Zend/Http/Response.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');

$yt = new Zend_Gdata_YouTube();
$query = $yt->newVideoQuery();

$query->videoQuery = $trailer;
$query->startIndex = 1;
$query->maxResults = 1;
$query->orderBy = 'relevance';
$query->format = 0;

$videoFeed=$yt->getVideoFeed($query);

foreach ($videoFeed as $videoEntry) {
 
$relatedLinkHref = $videoEntry->getVideoId(); 

Any ideas gratefully appreciated.

Brett

-- 
View this message in context: http://www.nabble.com/youtube-and-503-error
s-tp16303001p16303001.html
Sent from the Zend gdata mailing list archive at
Nabble.com.


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )