We need to do some work refactoring the functions that handle accessing video feeds.
It'd be nice to have something along the lines of youtube_api_get_feed($resource, $headers, $options) function, which takes a arbitrary resource link and returns an array of video objects. It'd be nice if it supplied sensible defaults for the HTTP headers, but allowed them to be overridden via a $headers array that's passed as a parameter. In addition, implementation of pagination, number of videos to return, etc. could be handled through an $options array.
Once this is completed, It'd be great to refactor user feeds, searches, and default youtube feeds (most viewed, most popular, etc.) to all route their requests through this function.
Comments
Comment #1
beeradb commentedfixed by http://drupal.org/cvs?commit=123593
/**
* A generic function for getting the contents of a feed.
*
* @param $feed
* The URL of the feed.
* @param $start_at
* The record to start at.
* @param $num_items
* The number of items to return.
* @param $headers
* Additional headers to use in the request.
* @param $url_params
* Additional search contstraints as outlined at
* http://code.google.com/apis/youtube/developers_guide_protocol.html#Searc....
*/
Also added youtube_api_process_feed($feed, $comments)
/**
* A generic function parsing a tag.
*
* @param $feed
* A simplexml object feed data.
* @param $comments
* True if parsing a comment feed, false otherwise.
*/