public static function parse($url) { $html = Base::_cget($url); $vid = ''; $vids = $data = $video_data = array(); preg_match("#vid:\\s*([\\d]+),#ms", $html, $vids); $vid = $vids[1] ? trim($vids[1]) : ''; if (empty($vid)) { return false; exit(0); } else { $tkey = Letv::getKey(time()); //通过解析 乐视 的xml 来获得视频地址 tkey值需要计算 $xml_url = "http://api.letv.com/mms/out/video/play?id={$vid}&platid=1&splatid=101&format=0&tkey={$tkey}&domain=www.letv.com"; $video_data = Letv::parseXml($xml_url); if ($video_data) { //存有视频的数组 有 dispatch dispatchbak dispatchbak1 dispatchbak2 这里使用 dispatch if (is_array($video_data['dispatch']) && !empty($video_data['dispatch'])) { foreach ($video_data['dispatch'] as $key => $val) { //加上后面的参数才可以播放 if ($key == "350") { $data['fluent'][] = Letv::getPlayUrl($val[0]); } if ($key == "1000") { $data['normal'][] = Letv::getPlayUrl($val[0]); } if ($key == "1300") { $data['high'][] = Letv::getPlayUrl($val[0]); } if ($key == "720p") { $data['super'][] = Letv::getPlayUrl($val[0]); } if ($key == "1080p") { $data['original'][] = Letv::getPlayUrl($val[0]); } } } $data['title'] = $video_data['title']; $data['seconds'] = $video_data['duration']; return $data; } else { return false; } } }
/** * [_parseLetv 解析乐视视频] * @param [type] $url [description] * @return [type] [description] */ private static function _parseLetv($url) { $data = Letv::parse($url); return $data; }