Uusee.class.php 1.59 KB
<?php
class Util_Video_Api_Uusee extends Util_Video_Api
{
    private $xmlurl = "http://vi.uusee.com/{id}.xml";
    public function getData($url)
    {
        $id = $this->getid($url);
        $id = substr($id, 0, 2) . '/' . substr($id, 2, 2) . '/{' . $id . '}';
        $infourl = str_ireplace("{id}", $id, $this->xmlurl);
        $infodat = Util_Video_ApiConnect::get($infourl);
        $infodat = @simplexml_load_string($infodat);
        if(empty($infodat))
        {
            throw new Util_Video_ApiException("没有数据");
        }
        $dataobj = new Util_Video_Data($this->id);
        $dataobj->swf = (string) $infodat->videoinfo->playpath['url'];
        $date = str_replace(strrchr($url, '.'), '', substr(strrchr($url, '/'), 1));
        $dataobj->thumb = preg_replace("/http:\/\/(.*).uusee.com/is", 'http://img.uusee.com', str_ireplace($date . '.html', ($date + 2) . '.jpg', $url));
        $dataobj->time = "";
        $dataobj->title = (string) $infodat->videoinfo['name'];
        $dataobj->source = '来自于uusee.com';
        return $dataobj;
    }
    public function getid($url)
    {
        $url = $this->getUrl($url);
        if(preg_match("/http:\/\/.*.uusee.com/is", $url))
        {
            $htmldat = Util_Video_ApiConnect::get($url);
            if(preg_match_all("/guid = \"{(.*)}\"/isU", $htmldat, $out, 2))
            {
                $id = $out[0][1];
            }
            elseif(preg_match_all("/guid = \"(.*)\"/isU", $htmldat, $out, 2))
            {
                $id = $out[0][1];
            }
            $this->id = $id;
            return $id;
        }
    }

}

?>