Php 是否可以使用youtube API反转orderby结果?
关于:Php 是否可以使用youtube API反转orderby结果?,php,api,youtube,youtube-api,Php,Api,Youtube,Youtube Api,关于: 我使用orderby或Zend gdata API调用的setOrderBy来获得按viewcount排序的结果。它们按降序返回,我需要升序。可能吗?如果可以将结果放入数组,则可以通过调用array\u reverse()来颠倒顺序。如果可以将结果放入数组,则可以通过调用array\u reverse()来颠倒顺序。我知道我有点晚了,但我也遇到了同样的问题。我的方法(如果我发现API没有提供此功能)是使用“开始索引”简单地请求最后一部分。这有点烦人,但也有可能 $feedURL = 'h
我使用
orderby
或Zend gdata API调用的setOrderBy
来获得按viewcount排序的结果。它们按降序返回,我需要升序。可能吗?如果可以将结果放入数组,则可以通过调用array\u reverse()来颠倒顺序。如果可以将结果放入数组,则可以通过调用array\u reverse()来颠倒顺序。我知道我有点晚了,但我也遇到了同样的问题。我的方法(如果我发现API没有提供此功能)是使用“开始索引”简单地请求最后一部分。这有点烦人,但也有可能
$feedURL = 'http://gdata.youtube.com/feeds/api/videos?q='. $query .'author=' . $author;
$sxml = simplexml_load_file($feedURL);
$ind = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/')->totalResults;
$feedURL = 'http://gdata.youtube.com/feeds/api/videos?q='. $query .
'author='. $author .'orderby=published'.
'&max-result=100&start-index=' . ($ind-100);
/* save to some array and use. */
- 如果你能找到一个更简单的方法,我很高兴知道
- 我知道我有点晚了,但我也有同样的问题。我的方法(如果我发现API没有提供此功能)是使用“开始索引”简单地请求最后一部分。这有点烦人,但也有可能
$feedURL = 'http://gdata.youtube.com/feeds/api/videos?q='. $query .'author=' . $author;
$sxml = simplexml_load_file($feedURL);
$ind = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/')->totalResults;
$feedURL = 'http://gdata.youtube.com/feeds/api/videos?q='. $query .
'author='. $author .'orderby=published'.
'&max-result=100&start-index=' . ($ind-100);
/* save to some array and use. */
- 如果你能找到一个更简单的方法,我很高兴知道