Obtener diferentes ID de video YouTube

code.google.com's API for PHP

I have used this function : function printVideoEntry($videoEntry) and got

Video ID: XXXXXXXXXXXXXXXXXXXXXXXXXX
Watch page: http://www.youtube.com/watch?v=YYYYYYYYYYYYYY&feature=youtube_gdata_player
Flash Player Url: http://www.youtube.com/v/YYYYYYYYYYYYY?version=3&f=playlists&app=youtube_gdata

If I pass given video id it gives me error:

Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400 Invalid id'

And if I pass YYYYYYYYYYYYYYYYY from Watch page and Flash Player Url [both are same] I'm getting it what I need.

Help is much appreciated, Thanks in advance.

Using this function for getting video entries

function printVideoEntry($videoEntry) {
  echo "<div onclick=\"ytvbp.presentVideo('".$videoEntry->getVideoId()."')\" >";
  echo 'Video: '.$videoEntry->getVideoTitle() . "<br>";
  echo "</div>";
  echo 'Video ID: ' . $videoEntry->getVideoId() . "<br>";
  echo 'Watch page: ' . $videoEntry->getVideoWatchPageUrl() . "<br>";
  echo 'Flash Player Url: ' . $videoEntry->getFlashPlayerUrl() . "<br>";
} 

I'm calling print video function from

 function getAndPrintPlaylistVideoFeed($playlistListEntry) {
    $yt = new Zend_Gdata_YouTube();
    $playlistVideoFeed =  $yt->getPlaylistVideoFeed($playlistListEntry->getPlaylistVideoFeedUrl());
    foreach ($playlistVideoFeed as $playlistVideoEntry) {
    $getandprintplaylistvideofeed_array[] = printVideoEntry($playlistVideoEntry);
    }

preguntado el 01 de febrero de 12 a las 14:02

Apologies but this is first question form me on stackoverflow.. -

1 Respuestas

$videoEntry Debe ser un VideoEntry-object, which you can get based on an ID:

$videoEntry = $yt->getVideoEntry('the0KZLEacs');

Then you could call the function and set that as a parameter:

printVideoEntry($videoEntry);

Or you could edit the first lines of printVideoEntry:

function printVideoEntry($videoId) {
  $videoEntry = $yt->getVideoEntry('the0KZLEacs');
  //...
}

Primero eche un vistazo al sitio web de la página documentos to see what information you can squeeze out of a VideoEntry =)

Respondido 01 Feb 12, 20:02

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.