Reputation: 11
I am trying to fetch videos from the YouTube server based on my keywords, but when try to change the version 1 to version 2, it's not paginating.
I got following output from the YouTube server.
Search results
items found. Showing items to -1:
The following code I used to fetch the video from the YouTube server:
$feedURL = "http://gdata.youtube.com/feeds/api/videos?q={$vq}&v=2";
$sxml = simplexml_load_file($feedURL);
The following code for the pagination:
require_once 'Pager/Pager.php';
$params = array(
'mode' => 'Jumping',
'perPage' => $i,
'delta' => 5,
'totalItems' => $total,
);
$pager = & Pager::factory($params);
$links = $pager->getLinks();
Please anybody help me to resolve this issue.
Upvotes: 1
Views: 1210
Reputation: 56104
This is really a black box, because I don't know what Pager.php
is doing. It's not a standard part of any client library I know of.
The way paging works in the GData API v2 is described at a protocol level at https://developers.google.com/youtube/2.0/reference#Paging_through_Results. You can point the author of Pager.php
to that if they're unsure how they're supposed to handle things.
In general, you might find things easier if you use the Zend PHP GData client library. If you do, there's a description of how paging works when using the library at https://developers.google.com/youtube/2.0/developers_guide_php#Pagination
Upvotes: 1