Uusee.class.php
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?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;
}
}
}
?>