dongnan1989 2012-09-14 10:40
浏览 73

YouTube API版本2中的分页

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.

  • 写回答

1条回答 默认 最新

  • doukao2180 2012-09-20 04:29
    关注

    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

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测