Ben kullanıcılarımın siteme upload ettiği videoları ftp mde saklayıp 1 dakikada bir çalıştırdığım cronjob ile youtube api kullanarak youtube a upload ettiriyorum ve upload tamamlanınca ftp mden sildiriyorum.
API yi 12 Kasım da kurmuşum. Şuana kadar sorunsuz çalıştı. Ama şuan durduk yere böyle bir hata meydana gelmeye başladı: Validation failed
Uploadı şu kodlarla yaptırıyorum:
require_once 'Zend/Loader.php';
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 = 'asdf@gmail.com', $password = 'asdf', $service = 'youtube', $client = null, $source = 'MySource', $loginToken = null, $loginCaptcha = null, $authenticationURL );
$developerKey = 'Asdf1234';
$applicationId = 'Asdf';
$clientId = 'Asdf Video Uploader v1';
$yt = new Zend_Gdata_YouTube( $httpClient, $applicationId, $clientId, $developerKey );
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$filesource = $yt->newMediaFileSource( 'path/to/'.$video['dosyaismi'] );
$filesource->setContentType( 'application/octet-stream' );
$filesource->setSlug( 'path/to/'.$video['dosyaismi'] );
$myVideoEntry->setMediaSource( $filesource );
$myVideoEntry->setVideoTitle( 'Başlık' );
$myVideoEntry->setVideoDescription( 'Description' );
$myVideoEntry->setVideoCategory( 'Music' );
$myVideoEntry->SetVideoTags( 'Taglar' );
$myVideoEntry->setVideoDeveloperTags( array(
'mydevtag',
'anotherdevtag'
) );
$yt->registerPackage( 'Zend_Gdata_Geo' );
$yt->registerPackage( 'Zend_Gdata_Geo_Extension' );
$where = $yt->newGeoRssWhere();
$position = $yt->newGmlPos( '37.0 -122.0' );
$where->point = $yt->newGmlPoint( $position );
$myVideoEntry->setWhere( $where );
$uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads';
try {
$newEntry = $yt->insertEntry( $myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry' );
echo 'Upload tamamlandı.';
}
catch ( Zend_Gdata_App_HttpException $httpException ) {
echo $httpException->getRawResponseBody();
}
catch ( Zend_Gdata_App_Exception $e ) {
echo $e->getMessage();
}Asdf yazan yerlerde gerçek bilgileri yazıyo ve bugüne kadar sorun çıkarmamıştı o bilgiler. Developer key e falan çok aradım taradımda sorun ondadır diye. Yok yenisini aldım onda da aynı sorun falan.hatayı şu satır yakalıyo: $httpException->getRawResponseBody();
print_r( $httpException ) yapıncada gelen binlerce satır yazının başlangıcı şu şekilde:
Zend_Gdata_App_HttpException Object
(
[_httpClientException:protected] =>
[_response:protected] => Zend_Http_Response Object
(
[version:protected] => 1.1
[code:protected] => 400
[message:protected] => Bad Request
[headers:protected] => Array
(
[Server] => HTTP Upload Server Built on Dec 12 2012 15:53:08 (1355356388)
[X-gdata-user-country] => TR
[Content-type] => text/html; charset=UTF-8
[X-guploader-uploadid] => AEnB2UoE5L9u4FJc8I4A8WbAG-RrYs-BtMkhrWw9jaDpyUeH_voW4LdDNm91Eci042yHt9U8bdKWUP0zhRH6F4m7y5YIgtxqcg
[Date] => Thu, 03 Jan 2013 11:17:04 GMT
[Pragma] => no-cache
[Expires] => Fri, 01 Jan 1990 00:00:00 GMT
[Cache-control] => no-cache, no-store, must-revalidate
[Content-length] => 17
[Connection] => close
)
[body:protected] => Validation failed
)
[_previous:private] =>
[message:protected] => Expected response code 200, got 400
Validation failed
[string:private] =>
[code:protected] => 0
[file:protected] => /usr/local/lib/php/zf/library/Zend/Gdata/App.php
[line:protected] => 714
[trace:private] => Array( setMajor(2) mi ne diye bi kod var. onu da denedim fayda etmedi. )Bunun devamında videoyla alakalı isim bilgisi falan da var. yani hakkaten videoyu upload olaylarına kadar gitmiş kod.
Gmail ismini, şifresini, developer key falan gibi bilgileri değiştirip deniyim dedim. Hepsinde kendilerine has hatalar verdi.
Hele bi pm atında. Telefondan falan da görüşebiliriz.. Bunu çözemezsek te, daha yapıcı önerileriniz varsa aynı sistemi vimeo ya kurmak falan gibi onlarla alakalı da görüşebiliriz. Çünkü çözülemiyeceğine ikna olmuş durumdayım. Gece sabaha kadar aradım bulamadım çözümü.
Teşekkürler, kolay gelsin.
--R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 14:16:43 -->-> Daha önceki mesaj 13:25:41 --
Sorunu çözdüm arkadaşlar..
Sıra ile her bi dakikada bi video işlettiğim için ilk video yu yükleyemeyince kuyruk olmuştu. Bi ihtimal diyerek sorun çıkan video yu sıradan çektim. Sıra sorunsuz yüklenip işlenmeye devam ediyo şuan.
Videolar ftp mde de olduğu için indirip elimle yüklemeyi denemiştim. Videonun görüntü içeriği anlaşılamadı ve ses içeriği anlaşılamadı diye iki tane hata geliyodu zaten elle yüklerken. O yüzden böyle bi deniyim dedim. Birisi video olmayan bi dosyanın uzantısını video gibi değiştirip yüklemeye çalışmış. Uploadify de kabul etmiş..
Şimdiki sorunum gerçekten bi video olup olmadığını nasıl anlarız?

Moderatör arkadaş başlığı çözüldü olarak değiştirirse sevinirim.