分页在 Zend Gdata YouTube API 中不起作用

发布于 2024-12-28 14:38:57 字数 907 浏览 5 评论 0原文

我正在使用 Zend Gdata YouTube API 在 YouTube 上上传视频。它上传得很好。 我可以轻松地获取页面上的视频。但在此分页不起作用。我正在根据特定用户记录显示视频记录。它在一页上显示所有记录。我们在这里有下一个和后退链接。但单击后,它们会在每个页面上显示相同的记录。

我用过这个: http ://gdata.youtube.com/feeds/api/users/bbc/uploads/?start-index=1&max-results=10 但它只显示 10 个结果。虽然我已经上传了超过12个视频。

我还使用过:

$youTubeService = new Zend_Gdata_YouTube();
$query = $youTubeService->newVideoQuery();
$query->setQuery($searchTerm);
$query->setStartIndex($startIndex);
$query->setMaxResults($maxResults);
$feed = $youTubeService->getUserUploads(NULL,$query);

Here $startIndex 给出每次点击下一个或上一个的更新的 searchindex 值。但它也只给了我 10 个结果。 $maxResults 是否具有任何值 3、4 或 5。

这里我想应用分页来首先访问 5 个视频。然后单击网络链接后应显示接下来的五个结果。

如果有人对此有任何想法,请提供帮助。

I am working on uploads videos on YouTube using Zend Gdata YouTube API. It uploads well.
I can easily fetch the videos on a page. But in this paging doesn't works. i am showing video records on the basis of a specific user records. It shows all records on one page. we have next and back links here. but on click they shows same records on each page.

I have used this: http://gdata.youtube.com/feeds/api/users/bbc/uploads/?start-index=1&max-results=10
But it shows only 10 results. Although I have uploaded more than 12 videos.

I have also used:

$youTubeService = new Zend_Gdata_YouTube();
$query = $youTubeService->newVideoQuery();
$query->setQuery($searchTerm);
$query->setStartIndex($startIndex);
$query->setMaxResults($maxResults);
$feed = $youTubeService->getUserUploads(NULL,$query);

Here $startIndex gives the updated searchindex value for each click on next or previous. But it also giving me only 10 results. Whether $maxResults have any value 3, 4 or 5.

here i want to apply pagination to access 5 videos first. then on click of net link next five results should display.

Please help if anyone have some idea about this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

折戟 2025-01-04 14:38:57

看起来您将处理自己的分页。
此查询:

http://gdata.youtube.com/feeds/api/users/bbc/uploads/?start-index=1&max-results=10

将显示前 10 个结果,您将更改下一个结果的查询:

http://gdata.youtube.com/feeds/api/users/bbc/uploads/?start-index=11&max-results=10

试试这个,您把事情搞混了。您正在构建一个搜索 uri,然后尝试对特定用户调用它。如果您以不同的方式进行,可能会起作用,这应该可以让您到达起点。

 $youTubeService = new Zend_Gdata_YouTube(); 
        $query = $youTubeService->newVideoQuery(); 
        $query->author = $author; //if you want a users uploaded videos
        $query->startIndex = $startIndex; 
        $query->maxResults = $maxResults; 
        $feed = $youTubeService->getVideoFeed($query);

你仍然需要自己处理分页,尽管你可能会找到一种方法将其输入 Zend_Paginator 并使其工作。

It looks like you're going to handle you own pagination.
this query:

http://gdata.youtube.com/feeds/api/users/bbc/uploads/?start-index=1&max-results=10

will show the first 10 results, you'll have change the query for the next results:

http://gdata.youtube.com/feeds/api/users/bbc/uploads/?start-index=11&max-results=10

Try this, you were mixing things up. You were building a search uri and then trying to call it on a specific user. Might work if you did it a different way, this should get you to a starting place.

 $youTubeService = new Zend_Gdata_YouTube(); 
        $query = $youTubeService->newVideoQuery(); 
        $query->author = $author; //if you want a users uploaded videos
        $query->startIndex = $startIndex; 
        $query->maxResults = $maxResults; 
        $feed = $youTubeService->getVideoFeed($query);

you are still going to have to handle pagination yourself, although you can probably find a way to feed this into Zend_Paginator and make it work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文