How do I list all videos uploaded to Youtube?
I'm working with Youtube API and PHP library: http://code.google.com/apis/youtube/2.0/developers_guide_php.html
I'm modifying existing app: http://googlecodesamples.com/youtube/php/YouTubeVideoApp/index.php
That is also available in Zend Gdata library: [no link due to "new users can only post a maximum of two hyperlinks"]
My problem is: "retrieve my videos" retrieves only 25 and links "back" / "next" are not working :(
The workflow of Youtube API and ZendFramework is really complicated:
- index.php calls a javascript function declared in video_app.js
- ytVideoApp.listVideos calls ytVideoApp.presentFeed
- ytVideoApp.presentFeed sends ajax request operations.php
- operations.php strips parameters and calls proper function within itself, that is searchVideos
- searchVideos calls echoVideoList
- echoVideoList prints the data foreach ($feed as $entry)
- ytVideoApp.listVideos updates navigation (back/next buttons)
Existing value: ytVideoApp.MAX_RESULTS_LIST = 200;
I开发者_运维百科 also tried to hardcode it, rather than passing via parameter across php, js, ajax. In each case the I receive only 25 results. I tested in on two separate accounts (I do have 2 accounts with more than 25 uploads).
Is there any limitation that remains unknown to me?
Any hints, clues, whatever?
Here is your solution: http://markmail.org/message/n2px7yheizakzt7y#query:+page:1+mid:vcrj4gmyzfxdtpao+state:results (click on 'Peter December 5, 2010 - at the top')
As quoted from that link:
Here is the solution that I've come up [with]:
In
operations.php
find the line:$query->setQuery($searchTerm);
and comment it out.A few lines below, right under
$query->setMaxResults($maxResults);
add this:$query->setAuthor('millenniumpromise');
That's basically it! You can now use the
all
search type and get the results published only bymillenniumpromise
.I also needed to display the results by published date (most recent first), so I added
$query->setParam('orderby', 'published');
right below$query->setAuthor('millenniumpromise');
inoperations.php
And here is more help from the same players as above: http://osdir.com/ml/youtube-api-gdata/2010-11/msg00426.html
I must commend Peter and Neil for I have just spent the past week trying to nut this same problem out myself until I found their solution...
Regards, Adam
精彩评论