diff --git a/_function.php b/_function.php index 6bac0b1..4474240 100644 --- a/_function.php +++ b/_function.php @@ -6,11 +6,7 @@ * https://hakase.kr/ */ class Tvple { - private $httph = 'Mozilla/5.0'; - public function __construct() - { - ob_start(); - } + private $httph = 'DEXT5U5928d310'; /** * [splits description] * @param [type] $data [description] @@ -35,10 +31,6 @@ } private function WEBParsing($url,$bodychk=false,$paramType="GET",$param="",$cookie="") { - $uri = parse_url($url); - $paramType = strtoupper($paramType); - if (!$uri['port']) $uri['port'] = 80; - if (!$uri['path']) $uri['path'] = "/"; $ch = curl_init(); $opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $url, @@ -67,10 +59,6 @@ } private function Download($url,$range=0) { - $uri = parse_url($url); - $paramType = strtoupper($paramType); - if (!$uri['port']) $uri['port'] = 80; - if (!$uri['path']) $uri['path'] = "/"; $ch = curl_init(); $opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $url, @@ -93,23 +81,17 @@ $link = abs(intval($link)); if(!is_numeric($link)) exit; $data = $this->WEBParsing('http://tvple.com/'.$link); + $data = $this->WEBParsing('http://tvple.com/'.$this->splits($data, 'splits($data, '"og:title" content="','"')); $api = $this->splits($data,'data-meta="','"'); $data = $this->WEBParsing($api); - $url = $this->splits($data,'"mp4_avc": "','"'); + $link = $this->splits($data,'"mp4_avc": "','"'); - if(!$url) return false; - $data = $this->WEBParsing($url,true); + if(!$link) return false; // 2016-02-28 수정 - // FULL URL - while(strpos($data, 'HTTP/1.1 200 OK') === false) - { - $url = $this->splits($data,'Location: ',PHP_EOL); - $data = $this->WEBParsing($url,true); - } - $data = $this->WEBParsing($url,true); - + $data = $this->WEBParsing($link,true); $size = $length = $this->splits($data, 'Content-Length: ', PHP_EOL); $start = 0; // Start byte @@ -154,12 +136,11 @@ header('Content-Disposition: filename="'.$filename.'"'); set_time_limit(0); - ob_flush(); - flush(); + ob_start(); if ($rangeok) - $this->Download($url,$start.'-'.$end); + $this->Download($link,$start.'-'.$end); else - $this->Download($url); + $this->Download($link); ob_end_flush(); } - } \ No newline at end of file + } diff --git a/index.php b/index.php index de262ff..5fcf137 100644 --- a/index.php +++ b/index.php @@ -6,6 +6,8 @@ if($url) { $tvpleurl = 'http://tvple.com/'; if(substr($url,0,strlen($tvpleurl)) == $tvpleurl) $url = substr($url, strpos($url, $tvpleurl) + strlen($tvpleurl)); + $pos = strpos($url, '/'); + if($pos) $url = substr($url, $pos + 1); if(!is_numeric($url)) echo 'Error... (URL Error)'; else { @@ -21,6 +23,7 @@ --주소 형식--
ex1) http://tvple.com/1234
ex2) 1234
+ ex3) http://tvple.com/other/1234

티비플 접속해서 주소 가져오기