PHP抓取、分析国内视频网站的视频信息工具类(2)

if($data && $createObject) $data['object'] = "<embed src=https://www.jb51.net/article/\"{$data['swf']}\" quality=https://www.jb51.net/article/\"high\" width=https://www.jb51.net/article/\"480\" height=https://www.jb51.net/article/\"400\" align=https://www.jb51.net/article/\"middle\" allowNetworking=https://www.jb51.net/article/\"all\" allowScriptAccess=https://www.jb51.net/article/\"always\" type=https://www.jb51.net/article/\"application/x-shockwave-flash\"></embed>";
        return $data;
    }
    /**
     * 腾讯视频
     * ?vid=97abu74o4w3_0
     *
     *
     *
     * ?_v=20110829&vid=97abu74o4w3&autoplay=1&list=2&showcfg=1&tpid=23&title=%E7%AC%AC%E4%B8%80%E7%8E%B0%E5%9C%BA&adplay=1&cid=o9tab7nuu0q3esh
     */
    private function _parseQq($url){
        if(preg_match("/\/play\//", $url)){
            $html = self::_fget($url);
            preg_match("/url=[^\"]+/", $html, $matches);
            if(!$matches); return false;
            $url = $matches[0];
        }
        preg_match("/vid=([^\_]+)/", $url, $matches);
        $vid = $matches[1];
        $html = self::_fget($url);
        // query
        preg_match("/flashvars\s=https://www.jb51.net/article/\s\"([^;]+)/s", $html, $matches);
        $query = $matches[1];
        if(!$vid){
            preg_match("/vid\s?=https://www.jb51.net/article/\s?vid\s?\|\|\s?\"(\w+)\";/i", $html, $matches);
            $vid = $matches[1];
        }
        $query = str_replace('"+vid+"', $vid, $query);
        parse_str($query, $output);
        $data['img'] = "http://vpic.video.qq.com/{$$output['cid']}/{$vid}_1.jpg";
        $data['url'] = $url;
        $data['title'] = $output['title'];
        $data['swf'] = "http://imgcache.qq.com/tencentvideo_v1/player/TencentPlayer.swf?".$query;
        return $data;
    }
   

/**
     * 优酷网
     *
     *
     */
    private function _parseYouku($url){
        preg_match("#id\_(\w+)#", $url, $matches);

if (empty($matches)){
            preg_match("#v_playlist\/#", $url, $mat);
            if(!$mat) return false;

$html = self::_fget($url);

preg_match("#videoId2\s*=https://www.jb51.net/article/\s*\'(\w+)\'#", $html, $matches);
            if(!$matches) return false;
        }

$link = "http://v.youku.com/player/getPlayList/VideoIDS/{$matches[1]}/timezone/+08/version/5/source/out?password=&ran=2513&n=3";

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/ce64277ed0afb81a970acc7a6a0797f5.html