$data['img'] = $json['info']['img'];
$data['title'] = $json['info']['Subject'];
$data['url'] = $url;
$data['swf'] = "http://player.56.com/v_{$matches[1]}.swf";
return $data;
} else {
return false;
}
}
/**
* 乐视网
*
*
*/
private function _parseLetv($url){
$html = self::_fget($url);
preg_match("#([^'\"]*)#", $html, $matches);
parse_str(parse_url(urldecode($matches[0]), PHP_URL_QUERY));
preg_match("#vplay/(\d+)#", $url, $matches);
$data['img'] = $pic;
$data['title'] = $title;
$data['url'] = $url;
$data['swf'] = "http://www.letv.com/player/x{$matches[1]}.swf";
return $data;
}
// 搜狐TV
private function _parseSohu($url){
$html = self::_fget($url);
$html = iconv("GB2312", "UTF-8", $html);
preg_match_all("/og:(?:title|image|videosrc)\"\scontent=https://www.jb51.net/article/\"([^\"]+)\"/s", $html, $matches);
$data['img'] = $matches[1][1];
$data['title'] = $matches[1][0];
$data['url'] = $url;
$data['swf'] = $matches[1][2];
return $data;
}
/*
* 新浪播客
*
* =48717043_1290055681_PUzkSndrDzXK+l1lHz2stqkP7KQNt6nki2O0u1ehIwZYQ0/XM5GdatoG5ynSA9kEqDhAQJA4dPkm0x4/s.swf
*/
private function _parseSina($url){
preg_match("/(\d+)(?:\-|\_)(\d+)/", $url, $matches);
$url = "http://video.sina.com.cn/v/b/{$matches[1]}-{$matches[2]}.html";
$html = self::_fget($url);
preg_match("/video\s?:\s?([^<]+)}/", $html, $matches);
$find = array("/\n/", "/\s*/", "/\'/", "/\{([^:,]+):/", "/,([^:]+):/", "/:[^\d\"]\w+[^\,]*,/i");
$replace = array('', '', '"', '{"\\1":', ',"\\1":', ':"",');
$str = preg_replace($find, $replace, $matches[1]);
$arr = json_decode($str, true);
$data['img'] = $arr['pic'];
$data['title'] = $arr['title'];
$data['url'] = $url;
$data['swf'] = $arr['swfOutsideUrl'];
return $data;
}
/*
* 通过 file_get_contents 获取内容
*/
private function _fget($url=''){
if(!$url) return false;
$html = file_get_contents($url);
// 判断是否gzip压缩
if($dehtml = self::_gzdecode($html))
return $dehtml;
else
return $html;
}
/*
* 通过 fsockopen 获取内容
*/
private function _fsget($path='https://www.jb51.net/', $host='', $user_agent=''){
if(!$path || !$host) return false;
$user_agent = $user_agent ? $user_agent : self::USER_AGENT;