Yinyuetai.class.php
1.25 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_Yinyuetai extends Util_Video_Api
{
private $htmlurl = "http://www.yinyuetai.com/video/{id}";
private $swfurl = 'http://www.yinyuetai.com/video/player/{id}/v_0.swf';
/**
* @param unknown_type unknown_type $url
*/
public function getData($url)
{
$id = $this->getid($url);
$htmlurl = str_ireplace("{id}", $id, $this->htmlurl);
$htmldat = Util_Video_ApiConnect::get($htmlurl);
if(preg_match_all("@<h1 id=\"videoTitle\">(.*)<\/h1>@isU", $htmldat, $out, 2))
{
$title = $out[0][1];
}
if(empty($title))
{
throw new Util_Video_ApiException("没有标题");
}
$dataobj = new Util_Video_Data($this->id);
$dataobj->swf = str_ireplace("{id}", $id, $this->swfurl);
$dataobj->thumb = "";
$dataobj->time = "";
$dataobj->title = $title;
$dataobj->source = '来自于yinyuetai.com';
return $dataobj;
}
private function getid($url)
{
$url = $this->getUrl($url);
if(!preg_match("/^http:\/\/.*/si", $url))
{
$id = $url;
}
$id = substr(strrchr($url, '/'), 1);
$this->id = $id;
return $id;
}
}
?>