#3 문제 해결

일부 안 맞는 소스 수정
This commit is contained in:
hakasenyang
2017-01-06 08:51:01 +09:00
parent 1c7e0a46a3
commit 854735594b
3 changed files with 33 additions and 34 deletions
+10 -13
View File
@@ -11,9 +11,6 @@
} }
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);
if (!isset($uri['port'])) $uri['port'] = 80;
if (!isset($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,
@@ -44,8 +41,9 @@
* 소스 : 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)
{ {
@@ -174,7 +172,7 @@
// 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;
@@ -195,17 +193,16 @@
} }
public function GetCookie() public function GetCookie()
{ {
$data = $this->WEBParsing('http://www.yuncomics.com/archives/'); /*$data = $this->WEBParsing('http://wasabisyrup.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://wasabisyrup.com/archives/455742', $cookie, true, 'pass=qndxkr',
array( array(
'Referer: http://www.yuncomics.com/' 'Referer: http://wasabisyrup.com/'
) )
); );
$cookie2 = $this->splits($data, 'Set-Cookie: wp-postpass_', ';'); $cookie = $this->splits($data, 'Set-Cookie: PHPSESSID=', ';');
$cookie2 = ';wp-postpass_'.$cookie2.';wordpress_test_cookie=WP+Cookie+check;_mcnc=1;'; $cookie = 'PHPSESSID=' . $cookie . ';';
$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)
@@ -217,7 +214,7 @@
switch($num) switch($num)
{ {
case 0: case 0:
$err='Connect Error (yuncomics 403 or other error)'; $err='Connect Error (wasabisyrup 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)';
+1 -1
View File
@@ -278,7 +278,7 @@ var EpisodePage = function (_React$Component) {
}, { }, {
key: '_convertUrl', key: '_convertUrl',
value: function _convertUrl(url) { value: function _convertUrl(url) {
if (url.toLowerCase().indexOf("yuncomic") > -1) { if (url.toLowerCase().indexOf("wasabisyrup") > -1) {
//var comps = url.split('/').slice(3); //var comps = url.split('/').slice(3);
//return config.apiUrl + "/image_parse.php?url=" + url; //return config.apiUrl + "/image_parse.php?url=" + url;
//return config.apiUrl + "/image/" + comps.join("/"); //return config.apiUrl + "/image/" + comps.join("/");
+22 -20
View File
@@ -3,22 +3,22 @@
$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(!isset($num))
{ {
?> ?>
<!doctype html><html><head><title>Yuncomics(marumaru.in) Image URL Parser API</title><meta charset="UTF-8"> <!doctype html><html><head><title>wasabisyrup(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%;
}</style> }</style>
<link rel="shortcut icon" href="favicon.ico"> <link rel="shortcut icon" href="favicon.ico">
</head><body> </head><body>
<h1>Yuncomics(marumaru.in) <u>Image URL</u> Parser API</h1> <h1>wasabisyrup(marumaru.in) <u>Image URL</u> Parser API</h1>
<p>Using: /api/{yuncomics number}/{1 or 0(null)}<br> <p>Using: /api/{wasabisyrup number}/{1 or 0(null)}<br>
Use only application/web/other developers.</p> Use only application/web/other developers.</p>
<h2>Example</h2> <h2>Example</h2>
<p>no json - <a href="/api/553645" target="_blank">/api/553645 (Gochuumon wa Usagi desuka?)</a><br> <p>no json - <a href="/api/93" target="_blank">/api/93 (Himouto Umaru-Chan)</a><br>
json - <a href="/api/553645/1" target="_blank">/api/553645/1 (Gochuumon wa Usagi desuka?)</a><br> json - <a href="/api/93/1" target="_blank">/api/93/1 (Himouto Umaru-Chan?)</a><br>
<a href="https://github.com/fmaru/fmaru" rel="noreferrer" target="_blank">fmaru</a> php porting by hakase - <a href="/fmaru" target="_blank">/fmaru</a><br> <a href="https://github.com/fmaru/fmaru" rel="noreferrer" target="_blank">fmaru</a> php porting by hakase - <a href="/fmaru" target="_blank">/fmaru</a><br>
image direct view - <a href="/img/553645" target="_blank">/img/553645 (Gochuumon wa Usagi desuka?)</a></p> image direct view - <a href="/img/93" target="_blank">/img/93 (Himouto Umaru-Chan)</a></p>
<h2>JSON Type</h2> <h2>JSON Type</h2>
<p>title : Manga Subject<br> <p>title : Manga Subject<br>
url : Image URL<br> url : Image URL<br>
@@ -30,7 +30,7 @@ prevnext : Next Episode / Prev Episode (if not data, show null value)<br>
<p>First Line : Manga Subject<br> <p>First Line : Manga Subject<br>
Other Line : Image URL</p> Other Line : Image URL</p>
<h2>Error Message</h2> <h2>Error Message</h2>
<p>Number 0 : Connect Error (yuncomics 403 or other error)<br> <p>Number 0 : Connect Error (wasabisyrup 403 or other error)<br>
Number 1 : Cookie Send Error (Not applied sucuri cookie data)<br> Number 1 : Cookie Send Error (Not applied sucuri cookie data)<br>
Number 2 : Cookie Get Error<br> Number 2 : Cookie Get Error<br>
Number 3 : Password Error (Protected archive) - Retry 10 minutes after view or retry about 3 times)<br> Number 3 : Password Error (Protected archive) - Retry 10 minutes after view or retry about 3 times)<br>
@@ -62,7 +62,7 @@ cookieget:
startdata: startdata:
$caches++; $caches++;
$data = $marumaru->WEBParsing('http://www.yuncomics.com/archives/'.$num, $cookie); $data = $marumaru->WEBParsing('http://wasabisyrup.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];
@@ -73,7 +73,7 @@ startdata:
$marumaru->ErrorEcho(4); $marumaru->ErrorEcho(4);
if(stripos($data, 'HTTP/1.1 200 OK') === false) if(stripos($data, 'HTTP/1.1 200 OK') === false)
$marumaru->ErrorEcho(0); $marumaru->ErrorEcho(0);
if(stripos($data, 'This content is password protected.') !== false) if(stripos($data, '<h2>Protected</h2>') !== false)
if($caches > 5) if($caches > 5)
$marumaru->ErrorEcho(3); $marumaru->ErrorEcho(3);
else else
@@ -81,25 +81,27 @@ startdata:
$tmp2++; $tmp2++;
goto startdata; goto startdata;
} }
if(stripos($data, 'You are being redirected...') !== false) /*if(stripos($data, 'You are being redirected...') !== false)
if($caches > 2) if($caches > 2)
$marumaru->ErrorEcho(1); $marumaru->ErrorEcho(1);
else else
{ {
$tmp++; $tmp++;
goto cookieget; 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 = $marumaru->splits($data, '<select class="list-articles select-js-inline select-js-nofocus select-js-inline-right">', '</select>');
$data2 = explode('<option value="', str_replace('selected>', '>', $data2));
$data2 = str_replace(array("\t", PHP_EOL), NULL, $data2);
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="', str_replace('data-src="/storage/', 'data-src="http://wasabisyrup.com/storage/', $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>';
@@ -108,21 +110,21 @@ startdata:
{ {
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)
{ {