class repository_youtube extends repository {
public function __construct($repositoryid, $context = SITEID, $options = array()) {
- $options['keyword'] = optional_param('youtube_keyword', '', PARAM_RAW);
- $options['start'] =1;
- $options['max'] = 27;
- $options['sort'] = 'relevance';
+ $this->keyword = optional_param('youtube_keyword', '', PARAM_RAW);
+ $this->start =1;
+ $this->max = 27;
+ $this->sort = 'published';
parent::__construct($repositoryid, $context, $options);
}
private function _get_collection($keyword, $start, $max, $sort) {
$list = array();
- $this->feed_url = 'http://gdata.youtube.com/feeds/api/videos?vq=' . urlencode($keyword) . '&format=5&start-index=' . $start . '&max-results=' .$max . '&orderby=' . $sort;
+ $this->feed_url = 'http://gdata.youtube.com/feeds/api/videos?q=' . urlencode($keyword) . '&format=5&start-index=' . $start . '&max-results=' .$max . '&orderby=' . $sort;
$c = new curl(array('cache'=>true, 'module_cache'=>'repository'));
$content = $c->get($this->feed_url);
$xml = simplexml_load_string($content);