2

I have a feed with 50 items but seemingly no matter what I do, it always returns just 25.

$feed->set_item_limit(50); or $rss_items = $rss->get_items(0,50); none of these have any effect nor do I see any reference to the number 25 in the class source, I don't get it.

The feed is http://gdata.youtube.com/feeds/base/users/silviavaldemoros/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile&max-results=50

1 Answer 1

3
    include_once(ABSPATH.WPINC.'/feed.php');
    $rss = fetch_feed('http://gdata.youtube.com/feeds/base/users/silviavaldemoros/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile&max-results=50');
    $maxitems = $rss->get_item_quantity(50);

    $rss_items = $rss->get_items(0, $maxitems);
    print_r($rss_items);

Try this code..

1
  • My feed URL was htmlentities encoded which made it disregard the & bits of the URL -.- And YouTube v2 api sends 25 items by default. Your answer made me realize that I did it correctly but the URL was bad. Dec 12, 2014 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.