"", 'browse' => '', // see above 'time' => '', // only if browse 'category' => '', // only if browse 'language' => '', // only if browse 'index' => 0, // only if browse 'style' => 'inline', // or link. link links to youtube. 'size' => 'medium', // or large, medium or small 'autoplay' => 0, 'width' => "425", 'height' => "350"); } function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); extract($args); if (empty($args['v'])) { if (empty($args['browse'])) return $this->error(fmt("Required argument %s missing", "v")); $this->_browse = array("Most Recent" => "mr", "Most Viewed" => "mp", "Top Rated" => "tr", "Most Discussed" => "md", "Top Favorites" => "mf", "Most Linked" => "mrd", "Recently Featured" => "rf", "Most Responded" => "ms", "Watch on Mobile" => "mv"); $this->browse = array_keys($this->_browse); array_unshift($this->browse, "Daily Pick"); $this->_time = array("Today" => "t", "This Week" => "w", "This Month" => "m", "All Time" => "a"); $this->_category = array("All" => "0", "Autos & Vehicles" => "2", "Comedy" => "23", "Entertainment" => "24", "Film & Animation" => "1", "Gadgets & Games" => "20", "Howto & DIY" => "26", "Music" => "10", "News & Politics" => "25", "People & Blogs" => "22", "Pets & Animals" => "15", "Sports" => "17", "Travel & Places" => "19"); $this->_language = array("All" => "", "English" => "EN", "Spanish" => "ES", "Japanese" => "JA", "German" => "DE", "Chinese" => "CN", "French" => "FR"); if (!in_array($browse, $this->browse)) return $this->error(fmt("Invalid argument %s", "browse")); if ($time and !in_array($time, array_keys($this->_time))) return $this->error(fmt("Invalid argument %s", "time")); if ($category and !in_array($category, $this->category)) return $this->error(fmt("Invalid argument %s", "category")); if ($language and !in_array($language, $this->language)) return $this->error(fmt("Invalid argument %s", "language")); if ($browse == "Daily Pick") $v = $this->Daily_pick(); else { $s = $this->_browse[$browse]; $t = $time ? $this->_time[$time] : 't'; $c = $category ? $this->_category[$category] : '0'; $l = $language ? $this->_language[$language] : ''; $url = "http://www.youtube.com/browse?s=$s&t=$t&c=$c&l=$l"; $m = array('', ''); if ($xml = url_get_contents($url)) { if ($index) { if (preg_match_all('/