mirror of
https://github.com/hakasenyang/marumaru-php-parser
synced 2026-08-22 02:03:08 +09:00
Style 수정
기존의 Tab 에서 Space 로 변경. 스타일 변경만 했으며 소스 수정을 따로 할 필요는 없음.
This commit is contained in:
+238
-238
@@ -1,241 +1,241 @@
|
|||||||
<?php
|
<?php
|
||||||
class Marumaru {
|
class Marumaru {
|
||||||
private $httph = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36';
|
private $httph = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36';
|
||||||
private $fname = 'cookie.txt';
|
private $fname = 'cookie.txt';
|
||||||
public function splits($data, $first, $end, $num = 1)
|
public function splits($data, $first, $end, $num = 1)
|
||||||
{
|
{
|
||||||
$temp = @explode($first, $data);
|
$temp = @explode($first, $data);
|
||||||
$temp = @explode($end, $temp[$num]);
|
$temp = @explode($end, $temp[$num]);
|
||||||
$temp = $temp[0];
|
$temp = $temp[0];
|
||||||
return $temp;
|
return $temp;
|
||||||
}
|
}
|
||||||
public function WEBParsing($url, $cookie=NULL, $headershow=TRUE, $postparam=NULL, $otherheader=NULL)
|
public function WEBParsing($url, $cookie=NULL, $headershow=TRUE, $postparam=NULL, $otherheader=NULL)
|
||||||
{
|
{
|
||||||
$uri = parse_url($url);
|
$uri = parse_url($url);
|
||||||
$paramType = strtoupper($paramType);
|
$paramType = strtoupper($paramType);
|
||||||
if (!$uri['port']) $uri['port'] = 80;
|
if (!$uri['port']) $uri['port'] = 80;
|
||||||
if (!$uri['path']) $uri['path'] = "/";
|
if (!$uri['path']) $uri['path'] = "/";
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
$opts = array(CURLOPT_RETURNTRANSFER => true,
|
$opts = array(CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_URL => $url,
|
CURLOPT_URL => $url,
|
||||||
CURLOPT_TIMEOUT => 10,
|
CURLOPT_TIMEOUT => 10,
|
||||||
CURLOPT_CONNECTTIMEOUT => 5,
|
CURLOPT_CONNECTTIMEOUT => 5,
|
||||||
CURLOPT_SSL_VERIFYPEER => FALSE,
|
CURLOPT_SSL_VERIFYPEER => FALSE,
|
||||||
CURLOPT_HEADER => $headershow,
|
CURLOPT_HEADER => $headershow,
|
||||||
CURLOPT_USERAGENT => $this->httph
|
CURLOPT_USERAGENT => $this->httph
|
||||||
);
|
);
|
||||||
curl_setopt_array($ch, $opts);
|
curl_setopt_array($ch, $opts);
|
||||||
if ($otherheader) curl_setopt($ch, CURLOPT_HTTPHEADER, $otherheader);
|
if ($otherheader) curl_setopt($ch, CURLOPT_HTTPHEADER, $otherheader);
|
||||||
if ($cookie) curl_setopt($ch, CURLOPT_COOKIE, $cookie);
|
if ($cookie) curl_setopt($ch, CURLOPT_COOKIE, $cookie);
|
||||||
if ($postparam)
|
if ($postparam)
|
||||||
{
|
{
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postparam);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $postparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = curl_exec($ch);
|
$data = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
if ($curl_errno > 0)
|
if ($curl_errno > 0)
|
||||||
$this->ErrorEcho(14, 'Connect Error!!!');
|
$this->ErrorEcho(14, 'Connect Error!!!');
|
||||||
return ($data) ? $data : false;
|
return ($data) ? $data : false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* sucuri - sucuri 프록시 관련 쿠키 우회
|
* sucuri - sucuri 프록시 관련 쿠키 우회
|
||||||
* 소스 : https://github.com/organization/cloudflare-bypass
|
* 소스 : https://github.com/organization/cloudflare-bypass
|
||||||
* 소스 : http://cafe.naver.com/gogoomas/337647
|
* 소스 : http://cafe.naver.com/gogoomas/337647
|
||||||
* @param string $result 쿠키 string 입력
|
* @param string $result 쿠키 string 입력
|
||||||
* @return strring 쿠키 데이터 출력
|
* @return strring 쿠키 데이터 출력
|
||||||
*/
|
*/
|
||||||
public function sucuri($result)
|
public function sucuri($result)
|
||||||
{
|
{
|
||||||
if(strpos($result, 'sucuri_cloudproxy_js') !== false)
|
if(strpos($result, 'sucuri_cloudproxy_js') !== false)
|
||||||
{
|
{
|
||||||
$cp_temp1 = explode('S=\'', $result);
|
$cp_temp1 = explode('S=\'', $result);
|
||||||
$cp_temp2 = explode(';', $cp_temp1[1]);
|
$cp_temp2 = explode(';', $cp_temp1[1]);
|
||||||
$cp_script = $cp_temp2[0];
|
$cp_script = $cp_temp2[0];
|
||||||
$cp_temp1 = explode('A=\'', $result);
|
$cp_temp1 = explode('A=\'', $result);
|
||||||
$cp_temp2 = explode('\';', $cp_temp1[1]);
|
$cp_temp2 = explode('\';', $cp_temp1[1]);
|
||||||
$cp_chlist = $cp_temp2[0];
|
$cp_chlist = $cp_temp2[0];
|
||||||
$cp_charr = array();
|
$cp_charr = array();
|
||||||
for($i = 0; $i < 64; $i++)
|
for($i = 0; $i < 64; $i++)
|
||||||
$cp_charr[$cp_chlist[$i]] = $i;
|
$cp_charr[$cp_chlist[$i]] = $i;
|
||||||
$cp_len = strlen($cp_script);
|
$cp_len = strlen($cp_script);
|
||||||
$cp_c = 0;
|
$cp_c = 0;
|
||||||
$cp_u = 0;
|
$cp_u = 0;
|
||||||
$cp_i = 0;
|
$cp_i = 0;
|
||||||
$cp_l = 0;
|
$cp_l = 0;
|
||||||
$cp_a = NULL;
|
$cp_a = NULL;
|
||||||
$cp_r = NULL;
|
$cp_r = NULL;
|
||||||
for($i = 0; $i < $cp_len; $i++)
|
for($i = 0; $i < $cp_len; $i++)
|
||||||
{
|
{
|
||||||
$cp_c = $cp_charr[$cp_script[$i]];
|
$cp_c = $cp_charr[$cp_script[$i]];
|
||||||
$cp_u = ($cp_u << 6) + $cp_c;
|
$cp_u = ($cp_u << 6) + $cp_c;
|
||||||
$cp_l += 6;
|
$cp_l += 6;
|
||||||
while($cp_l >= 8)
|
while($cp_l >= 8)
|
||||||
(($cp_a = ($cp_u >> ($cp_l -= 8)) & 0xff) || ($cp_i < ($cp_len - 2))) && ($cp_r .= chr($cp_a));
|
(($cp_a = ($cp_u >> ($cp_l -= 8)) & 0xff) || ($cp_i < ($cp_len - 2))) && ($cp_r .= chr($cp_a));
|
||||||
}
|
}
|
||||||
$cp_temp1 = explode('document.cookie=', $cp_r);
|
$cp_temp1 = explode('document.cookie=', $cp_r);
|
||||||
$cp_temp2 = explode('=', $cp_temp1[1]);
|
$cp_temp2 = explode('=', $cp_temp1[1]);
|
||||||
$cp_cnam = str_replace('"', '\'', $cp_temp2[0]);
|
$cp_cnam = str_replace('"', '\'', $cp_temp2[0]);
|
||||||
$cp_cnam_split = explode('+', $cp_cnam);
|
$cp_cnam_split = explode('+', $cp_cnam);
|
||||||
$cp_cnam_split_cnt = count($cp_cnam_split);
|
$cp_cnam_split_cnt = count($cp_cnam_split);
|
||||||
$cp_cnam_string = NULL;
|
$cp_cnam_string = NULL;
|
||||||
for($i = 0 ; $i < $cp_cnam_split_cnt; $i++)
|
for($i = 0 ; $i < $cp_cnam_split_cnt; $i++)
|
||||||
{
|
{
|
||||||
$cp_cnam = trim($cp_cnam_split[$i]);
|
$cp_cnam = trim($cp_cnam_split[$i]);
|
||||||
if(strpos($cp_cnam, 'slice') !== false)
|
if(strpos($cp_cnam, 'slice') !== false)
|
||||||
{
|
{
|
||||||
$cp_temp1 = explode('\'', $cp_cnam);
|
$cp_temp1 = explode('\'', $cp_cnam);
|
||||||
$cp_temp2 = explode('(', $cp_cnam);
|
$cp_temp2 = explode('(', $cp_cnam);
|
||||||
$cp_temp3 = explode(')', $cp_temp2[1]);
|
$cp_temp3 = explode(')', $cp_temp2[1]);
|
||||||
$cp_temp4 = explode(',', $cp_temp3[0]);
|
$cp_temp4 = explode(',', $cp_temp3[0]);
|
||||||
$cp_cnam_string .= substr($cp_temp1[1], trim($cp_temp4[0]), (intval(trim($cp_temp4[1])-trim($cp_temp4[0]))));
|
$cp_cnam_string .= substr($cp_temp1[1], trim($cp_temp4[0]), (intval(trim($cp_temp4[1])-trim($cp_temp4[0]))));
|
||||||
}
|
}
|
||||||
elseif(strpos($cp_cnam, 'charAt') !== false)
|
elseif(strpos($cp_cnam, 'charAt') !== false)
|
||||||
{
|
{
|
||||||
$cp_temp1 = explode('\'', $cp_cnam);
|
$cp_temp1 = explode('\'', $cp_cnam);
|
||||||
$cp_temp2 = explode('(', $cp_cnam);
|
$cp_temp2 = explode('(', $cp_cnam);
|
||||||
$cp_temp3 = explode(')', $cp_temp2[1]);
|
$cp_temp3 = explode(')', $cp_temp2[1]);
|
||||||
$cp_cnam_string .= substr($cp_temp1[1], trim($cp_temp3[0]), 1);
|
$cp_cnam_string .= substr($cp_temp1[1], trim($cp_temp3[0]), 1);
|
||||||
}
|
}
|
||||||
elseif(strpos($cp_cnam, 'String.fromCharCode') !== false)
|
elseif(strpos($cp_cnam, 'String.fromCharCode') !== false)
|
||||||
{
|
{
|
||||||
$cp_temp1 = explode('(', $cp_cnam);
|
$cp_temp1 = explode('(', $cp_cnam);
|
||||||
$cp_temp2 = explode(')', $cp_temp1[1]);
|
$cp_temp2 = explode(')', $cp_temp1[1]);
|
||||||
if(strpos($cp_temp2[0], '0x') !== false)
|
if(strpos($cp_temp2[0], '0x') !== false)
|
||||||
$cp_cnam_string .= chr(hexdec($cp_temp2[0]));
|
$cp_cnam_string .= chr(hexdec($cp_temp2[0]));
|
||||||
else
|
else
|
||||||
$cp_cnam_string .= chr($cp_temp2[0]);
|
$cp_cnam_string .= chr($cp_temp2[0]);
|
||||||
}
|
}
|
||||||
elseif(strpos($cp_cnam, 'substr') !== false)
|
elseif(strpos($cp_cnam, 'substr') !== false)
|
||||||
{
|
{
|
||||||
$cp_temp1 = explode('\'', $cp_cnam);
|
$cp_temp1 = explode('\'', $cp_cnam);
|
||||||
$cp_temp2 = explode('(', $cp_cnam);
|
$cp_temp2 = explode('(', $cp_cnam);
|
||||||
$cp_temp3 = explode(')', $cp_temp2[1]);
|
$cp_temp3 = explode(')', $cp_temp2[1]);
|
||||||
$cp_temp4 = explode(',', $cp_temp3[0]);
|
$cp_temp4 = explode(',', $cp_temp3[0]);
|
||||||
$cp_cnam_string .= substr($cp_temp1[1], trim($cp_temp4[0]), trim($cp_temp4[1]));
|
$cp_cnam_string .= substr($cp_temp1[1], trim($cp_temp4[0]), trim($cp_temp4[1]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$cp_cnam_string .= trim(trim($cp_cnam, '\''));
|
$cp_cnam_string .= trim(trim($cp_cnam, '\''));
|
||||||
$cp_cnam_string .= NULL;
|
$cp_cnam_string .= NULL;
|
||||||
}
|
}
|
||||||
//$cp_temp1 = explode('=', $cp_r);
|
//$cp_temp1 = explode('=', $cp_r);
|
||||||
$cp_temp1 = strpos($cp_r, '=');
|
$cp_temp1 = strpos($cp_r, '=');
|
||||||
$cp_temp2 = explode(';document.cookie', substr($cp_r, $cp_temp1+1)); //$cp_temp[1]
|
$cp_temp2 = explode(';document.cookie', substr($cp_r, $cp_temp1+1)); //$cp_temp[1]
|
||||||
$cp_cval = str_replace('"', '\'', $cp_temp2[0]);
|
$cp_cval = str_replace('"', '\'', $cp_temp2[0]);
|
||||||
$cp_cval_split = explode('+', $cp_cval);
|
$cp_cval_split = explode('+', $cp_cval);
|
||||||
$cp_cval_split_cnt = count($cp_cval_split);
|
$cp_cval_split_cnt = count($cp_cval_split);
|
||||||
$cp_cval_string = null;
|
$cp_cval_string = null;
|
||||||
for($i = 0 ; $i < $cp_cval_split_cnt; $i++)
|
for($i = 0 ; $i < $cp_cval_split_cnt; $i++)
|
||||||
{
|
{
|
||||||
$cp_nval = trim($cp_cval_split[$i]);
|
$cp_nval = trim($cp_cval_split[$i]);
|
||||||
if(strpos($cp_nval, 'slice') !== false)
|
if(strpos($cp_nval, 'slice') !== false)
|
||||||
{
|
{
|
||||||
$cp_temp1 = explode('\'', $cp_nval);
|
$cp_temp1 = explode('\'', $cp_nval);
|
||||||
$cp_temp2 = explode('(', $cp_nval);
|
$cp_temp2 = explode('(', $cp_nval);
|
||||||
$cp_temp3 = explode(')', $cp_temp2[1]);
|
$cp_temp3 = explode(')', $cp_temp2[1]);
|
||||||
$cp_temp4 = explode(',', $cp_temp3[0]);
|
$cp_temp4 = explode(',', $cp_temp3[0]);
|
||||||
$cp_cval_string .= substr($cp_temp1[1], trim($cp_temp4[0]), (intval(trim($cp_temp4[1])-trim($cp_temp4[0]))));
|
$cp_cval_string .= substr($cp_temp1[1], trim($cp_temp4[0]), (intval(trim($cp_temp4[1])-trim($cp_temp4[0]))));
|
||||||
}
|
}
|
||||||
elseif(strpos($cp_nval, 'charAt') !== false)
|
elseif(strpos($cp_nval, 'charAt') !== false)
|
||||||
{
|
{
|
||||||
$cp_temp1 = explode("'", $cp_nval);
|
$cp_temp1 = explode("'", $cp_nval);
|
||||||
$cp_temp2 = explode("(", $cp_nval);
|
$cp_temp2 = explode("(", $cp_nval);
|
||||||
$cp_temp3 = explode(")", $cp_temp2[1]);
|
$cp_temp3 = explode(")", $cp_temp2[1]);
|
||||||
$cp_cval_string .= substr($cp_temp1[1], trim($cp_temp3[0]), 1);
|
$cp_cval_string .= substr($cp_temp1[1], trim($cp_temp3[0]), 1);
|
||||||
}
|
}
|
||||||
elseif(strpos($cp_nval, 'String.fromCharCode') !== false)
|
elseif(strpos($cp_nval, 'String.fromCharCode') !== false)
|
||||||
{
|
{
|
||||||
$cp_temp1 = explode('(', $cp_nval);
|
$cp_temp1 = explode('(', $cp_nval);
|
||||||
$cp_temp2 = explode(')', $cp_temp1[1]);
|
$cp_temp2 = explode(')', $cp_temp1[1]);
|
||||||
if(strpos($cp_temp2[0], '0x') !== false)
|
if(strpos($cp_temp2[0], '0x') !== false)
|
||||||
{
|
{
|
||||||
$cp_cval_string .= chr(hexdec($cp_temp2[0]));
|
$cp_cval_string .= chr(hexdec($cp_temp2[0]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cp_cval_string .= chr($cp_temp2[0]);
|
$cp_cval_string .= chr($cp_temp2[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif(strpos($cp_nval, 'substr') !== false)
|
elseif(strpos($cp_nval, 'substr') !== false)
|
||||||
{
|
{
|
||||||
$cp_temp1 = explode('\'', $cp_nval);
|
$cp_temp1 = explode('\'', $cp_nval);
|
||||||
$cp_temp2 = explode('(', $cp_nval);
|
$cp_temp2 = explode('(', $cp_nval);
|
||||||
$cp_temp3 = explode(')', $cp_temp2[1]);
|
$cp_temp3 = explode(')', $cp_temp2[1]);
|
||||||
$cp_temp4 = explode(',', $cp_temp3[0]);
|
$cp_temp4 = explode(',', $cp_temp3[0]);
|
||||||
$cp_cval_string .= substr($cp_temp1[1], trim($cp_temp4[0]), trim($cp_temp4[1]));
|
$cp_cval_string .= substr($cp_temp1[1], trim($cp_temp4[0]), trim($cp_temp4[1]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cp_cval_string .= trim(trim($cp_nval, '\''));
|
$cp_cval_string .= trim(trim($cp_nval, '\''));
|
||||||
}
|
}
|
||||||
$cp_cval_string .= NULL;
|
$cp_cval_string .= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// String Output
|
// String Output
|
||||||
return $cp_cnam_string."=".$cp_cval_string;
|
return $cp_cnam_string."=".$cp_cval_string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function FileRead($filename=NULL)
|
public function FileRead($filename=NULL)
|
||||||
{
|
{
|
||||||
$filename = ($filename) ? $filename : $this->fname;
|
$filename = ($filename) ? $filename : $this->fname;
|
||||||
if(!is_file($filename)) return false;
|
if(!is_file($filename)) return false;
|
||||||
if(!filesize($filename)) return false;
|
if(!filesize($filename)) return false;
|
||||||
$fp = fopen($filename, 'r');
|
$fp = fopen($filename, 'r');
|
||||||
$data = fread($fp, filesize($filename));
|
$data = fread($fp, filesize($filename));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
public function FileWrite($str,$filename=NULL,$time=(60*30))
|
public function FileWrite($str,$filename=NULL,$time=(60*30))
|
||||||
{
|
{
|
||||||
$filename = ($filename) ? $filename : $this->fname;
|
$filename = ($filename) ? $filename : $this->fname;
|
||||||
$fp = fopen($filename, 'w');
|
$fp = fopen($filename, 'w');
|
||||||
// 30분
|
// 30분
|
||||||
fwrite($fp, time()+$time.PHP_EOL.$str);
|
fwrite($fp, time()+$time.PHP_EOL.$str);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
public function GetCookie()
|
public function GetCookie()
|
||||||
{
|
{
|
||||||
$data = $this->WEBParsing('http://www.yuncomics.com/archives/');
|
$data = $this->WEBParsing('http://www.yuncomics.com/archives/');
|
||||||
$cookie = $this->splits($data, '<script>', '</script>');
|
$cookie = $this->splits($data, '<script>', '</script>');
|
||||||
$cookie = $this->sucuri($cookie);
|
$cookie = $this->sucuri($cookie);
|
||||||
$data = $this->WEBParsing('http://www.yuncomics.com/wp-login.php?action=postpass', $cookie, true, 'post_password=qndxkr&Submit=Submit',
|
$data = $this->WEBParsing('http://www.yuncomics.com/wp-login.php?action=postpass', $cookie, true, 'post_password=qndxkr&Submit=Submit',
|
||||||
array(
|
array(
|
||||||
'Referer: http://www.yuncomics.com/'
|
'Referer: http://www.yuncomics.com/'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$cookie2 = $this->splits($data, 'Set-Cookie: wp-postpass_', ';');
|
$cookie2 = $this->splits($data, 'Set-Cookie: wp-postpass_', ';');
|
||||||
$cookie2 = ';wp-postpass_'.$cookie2.';wordpress_test_cookie=WP+Cookie+check;_mcnc=1;';
|
$cookie2 = ';wp-postpass_'.$cookie2.';wordpress_test_cookie=WP+Cookie+check;_mcnc=1;';
|
||||||
$cookie .= $cookie2;
|
$cookie .= $cookie2;
|
||||||
if(!$cookie) return false; else return $cookie;
|
if(!$cookie) return false; else return $cookie;
|
||||||
}
|
}
|
||||||
public function ErrorEcho($num,$err=NULL)
|
public function ErrorEcho($num,$err=NULL)
|
||||||
{
|
{
|
||||||
if($err)
|
if($err)
|
||||||
die(json_encode(array('error'=>$num, 'message'=>$err)));
|
die(json_encode(array('error'=>$num, 'message'=>$err)));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch($num)
|
switch($num)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
$err='Connect Error (yuncomics 403 or other error)';
|
$err='Connect Error (yuncomics 403 or other error)';
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$err='Cookie Send Error (Not applied sucuri cookie data)';
|
$err='Cookie Send Error (Not applied sucuri cookie data)';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$err='Cookie Get Error';
|
$err='Cookie Get Error';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$err='Password Error (Protected archive) - Retry 10 minutes after view or retry about 3 times';
|
$err='Password Error (Protected archive) - Retry 10 minutes after view or retry about 3 times';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
$err='Not found comics data';
|
$err='Not found comics data';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$err='Unknown Error. Please send me an e-mail (contact@hakase.kr)';
|
$err='Unknown Error. Please send me an e-mail (contact@hakase.kr)';
|
||||||
}
|
}
|
||||||
die(json_encode(array('error'=>$num, 'message'=>$err)));
|
die(json_encode(array('error'=>$num, 'message'=>$err)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,18 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=500, user-scalable=no">
|
<meta name="viewport" content="width=500, user-scalable=no">
|
||||||
<title>fmaru php porting by hakase</title>
|
<title>fmaru php porting by hakase</title>
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
|
||||||
<!--<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
<!--<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||||
rel="stylesheet">-->
|
rel="stylesheet">-->
|
||||||
<link href="style.css"
|
<link href="style.css"
|
||||||
rel="stylesheet">
|
rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body style="margin:0px">
|
<body style="margin:0px">
|
||||||
<div id="contents"></div>
|
<div id="contents"></div>
|
||||||
<script src="config.js"></script>
|
<script src="config.js"></script>
|
||||||
<script src="app.js"></script>
|
<script src="app.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+17
-17
@@ -1,21 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
include '_function.php';
|
include '_function.php';
|
||||||
$url = $_GET['url'];
|
$url = $_GET['url'];
|
||||||
$marumaru = new Marumaru();
|
$marumaru = new Marumaru();
|
||||||
|
|
||||||
$a = parse_url($url);
|
$a = parse_url($url);
|
||||||
switch($a['host'])
|
switch($a['host'])
|
||||||
{
|
{
|
||||||
case 'www.yuncomics.com':
|
case 'www.yuncomics.com':
|
||||||
case 'blog.yuncomics.com':
|
case 'blog.yuncomics.com':
|
||||||
case 'marumaru.in':
|
case 'marumaru.in':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Cache-Control: max-age=86400, public');
|
header('Cache-Control: max-age=86400, public');
|
||||||
header('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
|
header('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
|
||||||
header('Content-Type: image/jpeg');
|
header('Content-Type: image/jpeg');
|
||||||
echo $marumaru->WEBParsing($url, NULL, NULL);
|
echo $marumaru->WEBParsing($url, NULL, NULL);
|
||||||
?>
|
?>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once '_function.php';
|
include_once '_function.php';
|
||||||
$marumaru = new Marumaru();
|
$marumaru = new Marumaru();
|
||||||
$num = $_GET['num'];
|
$num = $_GET['num'];
|
||||||
$image = $_GET['image'];
|
$image = $_GET['image'];
|
||||||
if(!is_numeric($num) || strpos($num, '.'))
|
if(!is_numeric($num) || strpos($num, '.'))
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<!doctype html><html><head><title>Yuncomics(marumaru.in) Image URL Parser API</title><meta charset="UTF-8">
|
<!doctype html><html><head><title>Yuncomics(marumaru.in) Image URL Parser API</title><meta charset="UTF-8">
|
||||||
<style>body img { width: auto; height: auto; max-width: 100%;
|
<style>body img { width: auto; height: auto; max-width: 100%;
|
||||||
@@ -46,84 +46,84 @@ Only error / message method use</p>
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<?php
|
<?php
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
cookieget:
|
cookieget:
|
||||||
$dd = $marumaru->FileRead();
|
$dd = $marumaru->FileRead();
|
||||||
if(!$dd || explode(PHP_EOL, $dd)[0] < time())
|
if(!$dd || explode(PHP_EOL, $dd)[0] < time())
|
||||||
{
|
{
|
||||||
$cookie = $marumaru->GetCookie();
|
$cookie = $marumaru->GetCookie();
|
||||||
if(!$cookie) $marumaru->ErrorEcho(2);
|
if(!$cookie) $marumaru->ErrorEcho(2);
|
||||||
$marumaru->FileWrite($cookie);
|
$marumaru->FileWrite($cookie);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$cookie = explode(PHP_EOL, $dd)[1];
|
$cookie = explode(PHP_EOL, $dd)[1];
|
||||||
|
|
||||||
startdata:
|
startdata:
|
||||||
$caches++;
|
$caches++;
|
||||||
$data = $marumaru->WEBParsing('http://www.yuncomics.com/archives/'.$num, $cookie);
|
$data = $marumaru->WEBParsing('http://www.yuncomics.com/archives/'.$num, $cookie);
|
||||||
/*if(stripos($data, 'HTTP/1.1 301 Moved Permanently') !== false)
|
/*if(stripos($data, 'HTTP/1.1 301 Moved Permanently') !== false)
|
||||||
{
|
{
|
||||||
$num = explode('/', $marumaru->splits($data, 'Location: ', PHP_EOL))[4];
|
$num = explode('/', $marumaru->splits($data, 'Location: ', PHP_EOL))[4];
|
||||||
$data = $marumaru->WEBParsing('http://www.yuncomics.com/archives/'.$num, $cookie.$cookie2);
|
$data = $marumaru->WEBParsing('http://www.yuncomics.com/archives/'.$num, $cookie.$cookie2);
|
||||||
}*/
|
}*/
|
||||||
if(stripos($data, 'HTTP/1.1 404 Not Found') !== false || stripos($data, 'HTTP/1.1 301 Moved Permanently') !== false) $marumaru->ErrorEcho(4);
|
if(stripos($data, 'HTTP/1.1 404 Not Found') !== false || stripos($data, 'HTTP/1.1 301 Moved Permanently') !== false) $marumaru->ErrorEcho(4);
|
||||||
if(stripos($data, 'HTTP/1.1 200 OK') === false) $marumaru->ErrorEcho(0);
|
if(stripos($data, 'HTTP/1.1 200 OK') === false) $marumaru->ErrorEcho(0);
|
||||||
if(stripos($data, 'This content is password protected.') !== false)
|
if(stripos($data, 'This content is password protected.') !== false)
|
||||||
if($caches > 5) $marumaru->ErrorEcho(3);
|
if($caches > 5) $marumaru->ErrorEcho(3);
|
||||||
else goto startdata;
|
else goto startdata;
|
||||||
if(stripos($data, 'You are being redirected...') !== false)
|
if(stripos($data, 'You are being redirected...') !== false)
|
||||||
if($caches > 2) $marumaru->ErrorEcho(1);
|
if($caches > 2) $marumaru->ErrorEcho(1);
|
||||||
else goto cookieget;
|
else goto cookieget;
|
||||||
|
|
||||||
$jsonon = ($_GET['json'] == 1) ? true : false;
|
$jsonon = ($_GET['json'] == 1) ? true : false;
|
||||||
$aaa = explode('data-src="', $data);
|
$aaa = explode('data-src="', $data);
|
||||||
$title = $marumaru->splits($aaa[0], '<title>', '</title>');
|
$title = $marumaru->splits($aaa[0], '<title>', '</title>');
|
||||||
$title = trim(explode(' | ', $title)[0]);
|
$title = trim(explode(' | ', $title)[0]);
|
||||||
$data2 = explode('<option value="', str_replace(' selected>', '>', $data));
|
$data2 = explode('<option value="', str_replace(' selected>', '>', $data));
|
||||||
|
|
||||||
if ($image)
|
if ($image)
|
||||||
{
|
{
|
||||||
$jsonon = ($_GET['json'] == 1) ? true : false;
|
$jsonon = ($_GET['json'] == 1) ? true : false;
|
||||||
$aaa = explode('data-src="', $data);
|
$aaa = explode('data-src="', $data);
|
||||||
|
|
||||||
for($i=1;$i<count($aaa);$i++)
|
for($i=1;$i<count($aaa);$i++)
|
||||||
echo '<img src="'.trim(explode('"', $aaa[$i])[0]).'"><br>';
|
echo '<img src="'.trim(explode('"', $aaa[$i])[0]).'"><br>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for($i=1;$i<count($data2);$i++)
|
for($i=1;$i<count($data2);$i++)
|
||||||
{
|
{
|
||||||
if($num == trim(explode('">', $data2[$i])[0]))
|
if($num == trim(explode('">', $data2[$i])[0]))
|
||||||
{
|
{
|
||||||
if($i != count($data2) - 1)
|
if($i != count($data2) - 1)
|
||||||
{
|
{
|
||||||
$nextid = trim(explode('">', $data2[$i+1])[0]);
|
$nextid = trim(explode('">', $data2[$i+1])[0]);
|
||||||
$nextname = trim(explode('</option>', explode('">', $data2[$i+1])[1])[0]);
|
$nextname = trim(explode('</option>', explode('">', $data2[$i+1])[1])[0]);
|
||||||
}
|
}
|
||||||
if($i != 1)
|
if($i != 1)
|
||||||
{
|
{
|
||||||
$previd = trim(explode('">', $data2[$i-1])[0]);
|
$previd = trim(explode('">', $data2[$i-1])[0]);
|
||||||
$prevname = trim(explode('</option>', explode('">', $data2[$i-1])[1])[0]);
|
$prevname = trim(explode('</option>', explode('">', $data2[$i-1])[1])[0]);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$aac[] = [trim(explode('">', $data2[$i])[0]) => trim(explode('</option>', explode('">', $data2[$i])[1])[0])];
|
$aac[] = [trim(explode('">', $data2[$i])[0]) => trim(explode('</option>', explode('">', $data2[$i])[1])[0])];
|
||||||
}
|
}
|
||||||
if($previd || $nextid)
|
if($previd || $nextid)
|
||||||
{
|
{
|
||||||
if($previd) $aad[] = ['prev'=>[$previd=>$prevname]]; else $aad[] = ['prev'=>null];
|
if($previd) $aad[] = ['prev'=>[$previd=>$prevname]]; else $aad[] = ['prev'=>null];
|
||||||
if($nextid) $aad[] = ['next'=>[$nextid=>$nextname]]; else $aad[] = ['next'=>null];
|
if($nextid) $aad[] = ['next'=>[$nextid=>$nextname]]; else $aad[] = ['next'=>null];
|
||||||
}
|
}
|
||||||
for($i=1;$i<count($aaa);$i++)
|
for($i=1;$i<count($aaa);$i++)
|
||||||
$aab[] = trim(explode('"', $aaa[$i])[0]);
|
$aab[] = trim(explode('"', $aaa[$i])[0]);
|
||||||
|
|
||||||
if($jsonon)
|
if($jsonon)
|
||||||
{
|
{
|
||||||
$aaaa = array('title'=>$title, 'url'=>$aab, 'explorer'=>$aac, 'prevnext'=>$aad);
|
$aaaa = array('title'=>$title, 'url'=>$aab, 'explorer'=>$aac, 'prevnext'=>$aad);
|
||||||
echo json_encode($aaaa);
|
echo json_encode($aaaa);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
echo $title.PHP_EOL.implode(PHP_EOL, $aab);
|
echo $title.PHP_EOL.implode(PHP_EOL, $aab);
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once '_function.php';
|
include_once '_function.php';
|
||||||
$marumaru = new Marumaru();
|
$marumaru = new Marumaru();
|
||||||
$data = $marumaru->WEBParsing('http://marumaru.in/'.$_GET['href']);
|
$data = $marumaru->WEBParsing('http://marumaru.in/'.$_GET['href']);
|
||||||
$data = str_replace('class="con_link" ', 'target="_blank" ', $data);
|
$data = str_replace('class="con_link" ', 'target="_blank" ', $data);
|
||||||
$thumb = $marumaru->splits($data, '<meta property="og:image" content="', '"');
|
$thumb = $marumaru->splits($data, '<meta property="og:image" content="', '"');
|
||||||
$a = explode('<a target="_blank" href="', $data);
|
$a = explode('<a target="_blank" href="', $data);
|
||||||
for($i=1;$i<count($a);$i++)
|
for($i=1;$i<count($a);$i++)
|
||||||
{
|
{
|
||||||
$href = explode('/', explode('"', $a[$i])[0])[4];
|
$href = explode('/', explode('"', $a[$i])[0])[4];
|
||||||
$title = str_replace(' ', ' ', strip_tags('<a target="_blank" href="'.explode('</a>', $a[$i])[0]));
|
$title = str_replace(' ', ' ', strip_tags('<a target="_blank" href="'.explode('</a>', $a[$i])[0]));
|
||||||
if(!$title) continue;
|
if(!$title) continue;
|
||||||
$episodes[] = ['href'=>$href, 'title'=>$title];
|
$episodes[] = ['href'=>$href, 'title'=>$title];
|
||||||
}
|
}
|
||||||
echo json_encode(array('cover'=>$thumb, 'episodes'=>$episodes));
|
echo json_encode(array('cover'=>$thumb, 'episodes'=>$episodes));
|
||||||
+19
-19
@@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once '_function.php';
|
include_once '_function.php';
|
||||||
$marumaru = new Marumaru();
|
$marumaru = new Marumaru();
|
||||||
$file = $marumaru->FileRead('mangalist.txt');
|
$file = $marumaru->FileRead('mangalist.txt');
|
||||||
if(!$file || explode(PHP_EOL, $file)[0] < time())
|
if(!$file || explode(PHP_EOL, $file)[0] < time())
|
||||||
{
|
{
|
||||||
$data = $marumaru->WEBParsing('http://marumaru.in/c/1');
|
$data = $marumaru->WEBParsing('http://marumaru.in/c/1');
|
||||||
$a = explode('" href="/b/manga/', $data);
|
$a = explode('" href="/b/manga/', $data);
|
||||||
$b = explode('<div width="200"><', $data);
|
$b = explode('<div width="200"><', $data);
|
||||||
for($i=1;$i<count($a);$i++)
|
for($i=1;$i<count($a);$i++)
|
||||||
{
|
{
|
||||||
$name = strip_tags('<'.explode('</div>', $b[$i])[0]);
|
$name = strip_tags('<'.explode('</div>', $b[$i])[0]);
|
||||||
$id = explode('"', $a[$i])[0];
|
$id = explode('"', $a[$i])[0];
|
||||||
$c[] = ['href'=>'/b/manga/'.$id, 'title'=>$name, 'id'=>$id];
|
$c[] = ['href'=>'/b/manga/'.$id, 'title'=>$name, 'id'=>$id];
|
||||||
}
|
}
|
||||||
$marumaru->FileWrite(json_encode(array('list'=>$c)), 'mangalist.txt');
|
$marumaru->FileWrite(json_encode(array('list'=>$c)), 'mangalist.txt');
|
||||||
$file = $marumaru->FileRead('mangalist.txt');
|
$file = $marumaru->FileRead('mangalist.txt');
|
||||||
}
|
}
|
||||||
echo explode(PHP_EOL, $file)[1];
|
echo explode(PHP_EOL, $file)[1];
|
||||||
exit;
|
exit;
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
/* fallback */
|
/* fallback */
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Material Icons';
|
font-family: 'Material Icons';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: local('Material Icons'), local('MaterialIcons-Regular'), url(/Material_Icons.woff2) format('woff2'), url(/Material_Icons.woff) format('woff');
|
src: local('Material Icons'), local('MaterialIcons-Regular'), url(/Material_Icons.woff2) format('woff2'), url(/Material_Icons.woff) format('woff');
|
||||||
}
|
}
|
||||||
|
|
||||||
.material-icons {
|
.material-icons {
|
||||||
font-family: 'Material Icons';
|
font-family: 'Material Icons';
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
letter-spacing: normal;
|
letter-spacing: normal;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
word-wrap: normal;
|
word-wrap: normal;
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
-webkit-font-feature-settings: 'liga';
|
-webkit-font-feature-settings: 'liga';
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user