2

For a youtube brand channel I need to find related videos only from the owner of that channel.

I use the Zend_Gdata_YouTube class. To search for videos by category or keywords I'am using the function getVideoFeed:

$this->yt->getVideoFeed('http://gdata.youtube.com/feeds/api/users/'.self::UPLOADER.'/uploads?category=' . $category)

for related videos I'am creating a new video query and set the feed type to related:

$ytQuery = $this->yt->newVideoQuery();
$ytQuery->setFeedType('related', $videoId);

I've searched everywhere but can't figure out how to set the uploader in the video query, nor how to create the right link for the video feed. However, there is the method setUploader that only accepts partner as parameter.

Is there any possibility to get related videos uploaded by a certain user, or do I have to write a function by my own?

Sascha Galley
  • 15,711
  • 5
  • 37
  • 51

2 Answers2

0
$q = new Zend_Gdata_YouTube_VideoQuery();
$q->setUploader($value);

$videos = $yt->getRelatedVideoFeed($videoid, $q);
Rufinus
  • 29,200
  • 6
  • 68
  • 84
  • The setUploader method only excepts 'partner' as parameter. when I try your code, I get: Fatal error: Uncaught exception 'Zend_Gdata_App_InvalidArgumentException' with message 'Unknown value for uploader'. – Sascha Galley Jun 03 '11 at 10:04
  • this will return the same results, videos of many other users too. thanks though. – Sascha Galley Jun 03 '11 at 10:30
0

well, the answer is a mix of all parts I already used and tried:

$query = $this->yt->newVideoQuery();

$query->setFeedType('related', $videoId);
$query->setMaxResults(4);
$query->setAuthor(self::UPLOADER);

$feed = $this->yt->getVideoFeed($query);

the direct API call would be:

$url = 'http://gdata.youtube.com/feeds/api/videos/'.$videoId.'/related?max-results=4&author='.self::UPLOADER;
Sascha Galley
  • 15,711
  • 5
  • 37
  • 51