How to get a Youtube channel RSS feed after 2015 April 20 (without v3 API)?

后端 未结 16 1222
野趣味
野趣味 2020-12-22 17:14

Now that API v2 is gone, what would be a way to get a simple RSS feed of a channel, without v3 API? I\'m open to Yahoo Pipes or any workaround that is simpler than creating

16条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-22 17:42

    I would suggest using an excellent rss parser. Many of them are available, but you can try http://simplepie.org/, one of the best I used for my personal projects.

    Its pretty well documented with some examples.

    Usage example

    Note:Used YouTube channel college humor, you can get it from the channel page itself

    set_feed_url('https://www.youtube.com/feeds/videos.xml?channel_id=UCPDXXXJj9nax0fr0Wfc048g');
    $feed->enable_cache(false);
    $feed->init();
    
    $items = $feed->get_items();
    
    foreach ($items as $item)
    {
        echo $item->get_title() . "\n";
    }
    
    var_dump($feed->get_item_quantity());
    

提交回复
热议问题