php各種視訊採集類封裝,優酷,土豆,騰訊視頻、56、搜狐視頻、酷六、新浪視頻、樂視.......
九弄 jigwang.com
-
- /**
- * 影片
- *
- * @package
- * @version 1.3
- * @copyright 20111 2013
- *
- * 實作
- * require_once "VideoUrlParser.class.php";
- * $urls[] = "http://v.youku.com/v_show/id_XMjI4MDM4NDc2.html"; * $urls[] = "http://www.tudou.com/playlist/p/l13087099.html";
- * $urls[] = "http://www.tudou.com/programs/view /ufg-A3tlcxk/";
- * $urls[] = "http://v.ku6.com/special/show_4926690/Klze2mhMeSK6g05X.html";
- * $urls[] = "http:// www.56.com/u68/v_NjI2NTkxMzc.html";
- * $urls[] = "http://www.letv.com/ptv/vplay/1168109.html";
- * $urls[] = "http://video.sina.com.cn/v/b/46909166-1290055681.html";
- *
- * foreach($urls as $url){
- * $info = VideoUrlParser ::parse($url);
- * //var_dump($info);
- * echo "{ $info ['title']}";
- * echo "
";
- * echo $info['object'];
- * echo "
";
- * }
- *
- *
- *
- * //優酷
- * http://v.youku.com/v_show/id_XMjU0NjY4OTEy.html
- *
- *
- * //酷六
- * http://v.ku6.com/special/show_3917484/x0BMXAbgZdQS6FqN.html
- *
- *
- * // 馬鈴薯
- * http://www.tudou.com/playlist/p /a65929.html? iid=74905844
- *
- *
- * //56
- * http://www.56 .com/u98/v_NTkyODY2NTU.html
- *
- *
- * //新浪播客
- * http://video.sina .com.cn/v/b/46909166 -1290055681.html
- *
- *
- * //樂視
- * http://www.letv.com/ptv/vplay/1168109.html
- *
- */
-
- class VideoUrlparser
- {
- const USER_AGENT =「Mozilla/5.0(Windows;你; Windows NT 5.1 ; en-US) AppleWebKit/534.10(KHTML,如Gecko)
- Chrome/8.0.552.224 Safari/534.10";
- const CHECK_URL_VALID = "/(youku.com|tudou.com|66. com |letv.com|video.sina.com.cn|(my.)?tv.sohu.com|v.qq.com)/";
-
- /**
- * 解析
- *
- * @param string $url
- * @param mix $createObject
- * @static
- * @access public
- * @return void
- */
- static public function parse($url='', $createObject=true){
- $lowerurl = strtolower($url);
- preg_match(self::CHECK_URL_VALID, $lowerurl, $matches);
- switch($matches[1]){
- case 'youku.com':
- $data = self::_parseYouku($url);
- 中斷;
- case 'tudou.com':
- $data = self::_parseTudou($url);
- 中斷;
- case 'ku6.com':
- $data = self ::_parseKu6($url);
- 中斷;
- case '56.com':
- $data = self::_parse56($url);
- 中斷;
- case 'letv . com':
- $data = self::_parseLetv($url);
- break;
- case 'video.sina.com.cn':
- $data = self::_parseSina($ url );
- break;
- case 'my.tv.sohu.com':
- case 'tv.sohu.com':
- case 'sohu.com':
- $data = self ::_parseSohu($url);
- 中斷;
- case 'v.qq.com':
- $data = self::_parseQq($url);
- 中斷;
- 預設:
- $data = false;
- }
-
- if($data && $createObject) $data['object'] = "
*/
|
複製程式碼