VideoParse.class.php 1016 Bytes
<?php
class Lib_Utils_VideoParse
{
    /**
     * 获得视频信息统一入口
     *
     * @param array $url
     * @return false|array('title'=>'标题','pic'=>'缩略图','url'=>'播放地址')
     */
    public static function getVideoInfo($url) 
    {
        //如果已经存在信息,则直接返回
        $shortcode = Util_StringHelper::getShortLink ( $url );
        $t = Facade_Fragment_Shortlink::getShortlink ( $shortcode );
        $aVinfo = Facade_Fragment_Shortlink::getVideo ( $shortcode );
        $aVinfo = $t = array();
        if (! empty ( $t ) && ! empty ( $aVinfo ))
        {
            return array ('title' => $aVinfo ['title'], 'pic' => $aVinfo ['img_url'], 'url' => $aVinfo ['video_url'] );
        }
        try
        {
            $aVinfo = Util_Video_Api::autoGetData($url);
            return array ('title' => $aVinfo->title, 'pic' => $aVinfo->thumb, 'url' => $aVinfo->swf);
        }
        catch(Exception $e)
        {
            return false;
        }
    }
    
}