"MDL-16911, update youtube repository plugin"
authordongsheng <dongsheng>
Thu, 13 Aug 2009 03:35:23 +0000 (03:35 +0000)
committerdongsheng <dongsheng>
Thu, 13 Aug 2009 03:35:23 +0000 (03:35 +0000)
repository/youtube/repository.class.php

index c69275086ae800abb45b53731aa0458fa367d37d..948d95f2c965372870854394b8aa8421e04acb40 100644 (file)
@@ -9,10 +9,10 @@
 
 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);
     }
 
@@ -29,7 +29,7 @@ class repository_youtube extends repository {
 
     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);