Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

SRL_23

[Resolvido] Google Api Youtube

Recommended Posts

Bom dia Senhores.

 

Pretendo usar o youtube como repositório de videos para um cliente meu.

 

Agora estou com o seguinte problema, não estou conseguindo passar os videos privados no meu site, roda somente se eu estiver logado no site do youtube, estou fazendo da seguinte forma.

 

<?php

require_once 'Zend/Loader.php'; // the Zend dir must be in your include_path
Zend_Loader::loadClass('Zend_Gdata_YouTube');

Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); 

$authenticationURL = 'https://www.google.com/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
             $username = '*******',
             $password = '*******',
             $service = 'youtube',
             $client = null,
             $source = '*******', // a short string identifying your application
             $loginToken = null,
             $loginCaptcha = null,
             $authenticationURL
            );
//print_r($httpClient);
//die;         

$developerKey = 'AI39si6******';//chave developerKey nao vou colocar aqui XD
$applicationId = 'Video uploader v1';
$clientId = '**********';
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
$yt->setMajorProtocolVersion(2);

$videoIdOfPrivateVideo = 'cFP6AhWivB4'; 
$location = 'http://gdata.youtube.com/feeds/api/users/default/uploads/' . $videoIdOfPrivateVideo;  
$videoEntry = $yt->getVideoEntry($videoIdOfPrivateVideo, $location); 

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 <title>YouTube data API Video Browser in PHP</title>
</head>

<body>
 <div id="main">
   <br />
<iframe id="ytplayer" type="text/html" width="640" height="360" src="<?php echo $videoEntry->getFlashPlayerUrl();?>" frameborder="0" allowfullscreen> </iframe>

</div>
</body>
</html>

 

Estou usando somente a biblioteca zend e nao o framework.

 

Eu tenho acesso a todas as informaçoes do video pelo

print_r($videoEntry);

e tudo mais mas quando tento ver o video pelo site com o:

<iframe id="ytplayer" type="text/html" width="640" height="360" src="<?php echo $videoEntry->getFlashPlayerUrl();?>" frameborder="0" allowfullscreen> </iframe>

 

Simplesmente ele informa que o vídeo é privado.

 

Alguém pode me dar uma luz de como fazer isso funfar.

 

Obrigado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Opa foi mau Lucas Guima

 

Seguinte, o google nao permite fazer esse tipo de acesso pelo api deles, não da pra fazer o youtube como repositório de videos privados http://code.google.com/p/gdata-issues/issues/detail?id=520#makechanges

 

O negocio é deixar aberto ou não listado ai roda.

 

Tem outras soluções que eu to analisando como o vimeo premium e parece que o amazon tem um repositorio de video pago tbm.

 

 

Abraços.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.