From 36d0d2675e1df5d721a5e3c048d0a0ee8186d57e Mon Sep 17 00:00:00 2001 From: hakasenyang Date: Sun, 13 Nov 2016 05:32:26 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=ED=86=B5=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기존에 image.php 와 index.php 기능을 분리하던 것을 통합 - image.php 는 제거 됨. --- README.md | 4 +-- image.php | 80 ------------------------------------------------------- index.php | 71 +++++++++++++++++++++++++++--------------------- 3 files changed, 42 insertions(+), 113 deletions(-) delete mode 100644 image.php diff --git a/README.md b/README.md index 2467f5b..40a2005 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,11 @@ 2. 권한은 cookie.txt, mangalist.txt (쿠키 캐싱) 파일을 생성하기 위해 필요합니다. 3. api 관련 rewrite 는 아래를 참고하십시오. (nginx 기준) 4. rewrite 없이 사용하려면 소스를 수정하셔야 합니다. - + ``` rewrite ^/api/(.*)/(.*)$ /index.php?num=$1&json=1; rewrite ^/api/(.*)$ /index.php?num=$1; -rewrite ^/img/(.*)$ /image.php?num=$1; +rewrite ^/img/(.*)$ /index.php?num=$1&image=1; rewrite ^/fmaru$ /fmaru.php; ``` diff --git a/image.php b/image.php deleted file mode 100644 index efe64f2..0000000 --- a/image.php +++ /dev/null @@ -1,80 +0,0 @@ - -Yuncomics(marumaru.in) Image URL Parser - - - -

Yuncomics(marumaru.in) Image URL Parser
Using: /api/{yuncomics number}/{1 or 0(null)}
-Use only application/web/other developers.

-

Example
-no json - /api/553645 (Gochuumon wa Usagi desuka?)
-json - /api/553645/1 (Gochuumon wa Usagi desuka?)

-

JSON Type
-Title : Manga Subject
-URL : Image URL
-Explorer : Another same cartoon episode (same episode will be ignored) - ID => Name (if not data, replaced with a null value)
-PrevNext : Next Episode / Prev Episode - ID => Name (if not data, replaced with a null value)
-- Prev : ID => Name (or NULL)
-- Next : ID => Name (or NULL)

-

String Type
-First Line : Manga Subject
-Other Line : Image URL

-

Error Message View
-Number 0 : Connect Error (yuncomics 403 or other error)
-Number 1 : Cookie Send Error (Not applied sucuri cookie data)
-Number 2 : Cookie Get Error
-Number 3 : Password Error (Protected archive) - Retry 10 minutes after view or retry about 3 times)
-Number 4 : Not found comics data
-Other error : read the message

-

Output only JSON (Example) {"Error":1,"Message":"Error Message)"}
-Only Error / Message Method use

-

Domain : marumaru.hakase.kr

-

No Open Source. - I just not want.
오픈 소스 계획 없음. - 그냥 하기 싫어.

-

Developed by Hakase (contact@hakase.kr)
-사용은 자유고 제한 없음. 애초에 제한 있으면 API 인증키를 넣겠지만 귀찮아서 안 넣음. -

- - -FileRead(); - if(!$dd || explode(PHP_EOL, $dd)[0] < time()) - { - $cookie = $marumaru->GetCookie(); - if(!$cookie) $marumaru->ErrorEcho(2); - $marumaru->FileWrite($cookie); - } - else - $cookie = explode(PHP_EOL, $dd)[1]; - -startdata: - $caches++; - $data = $marumaru->WEBParsing('http://www.yuncomics.com/archives/'.$num, $cookie); - /*if(stripos($data, 'HTTP/1.1 301 Moved Permanently') !== false) - { - $num = explode('/', $marumaru->splits($data, 'Location: ', PHP_EOL))[4]; - $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 200 OK') === false) $marumaru->ErrorEcho(0); - if(stripos($data, 'This content is password protected.') !== false) - if($caches > 5) $marumaru->ErrorEcho(3); - else goto startdata; - if(stripos($data, 'You are being redirected...') !== false) - if($caches > 2) $marumaru->ErrorEcho(1); - else goto cookieget; - - $jsonon = ($_GET['json'] == 1) ? true : false; - $aaa = explode('data-src="', $data); - - for($i=1;$i
'; diff --git a/index.php b/index.php index 566393e..41501c9 100644 --- a/index.php +++ b/index.php @@ -2,6 +2,7 @@ include_once '_function.php'; $marumaru = new Marumaru(); $num = $_GET['num']; + $image = $_GET['image']; if(!is_numeric($num) || strpos($num, '.')) { ?> @@ -82,39 +83,47 @@ startdata: $title = trim(explode(' | ', $title)[0]); $data2 = explode('', explode('">', $data2[$i+1])[1])[0]); - } - if($i != 1) - { - $previd = trim(explode('">', $data2[$i-1])[0]); - $prevname = trim(explode('', explode('">', $data2[$i-1])[1])[0]); - } - continue; - } - $aac[] = [trim(explode('">', $data2[$i])[0]) => trim(explode('', explode('">', $data2[$i])[1])[0])]; - } - if($previd || $nextid) - { - if($previd) $aad[] = ['prev'=>[$previd=>$prevname]]; else $aad[] = ['prev'=>null]; - if($nextid) $aad[] = ['next'=>[$nextid=>$nextname]]; else $aad[] = ['next'=>null]; - } - for($i=1;$i$title, 'url'=>$aab, 'explorer'=>$aac, 'prevnext'=>$aad); - echo json_encode($aaaa); + for($i=1;$i
'; } else - echo $title.PHP_EOL.implode(PHP_EOL, $aab); + { + for($i=1;$i', $data2[$i])[0])) + { + if($i != count($data2) - 1) + { + $nextid = trim(explode('">', $data2[$i+1])[0]); + $nextname = trim(explode('', explode('">', $data2[$i+1])[1])[0]); + } + if($i != 1) + { + $previd = trim(explode('">', $data2[$i-1])[0]); + $prevname = trim(explode('', explode('">', $data2[$i-1])[1])[0]); + } + continue; + } + $aac[] = [trim(explode('">', $data2[$i])[0]) => trim(explode('', explode('">', $data2[$i])[1])[0])]; + } + if($previd || $nextid) + { + if($previd) $aad[] = ['prev'=>[$previd=>$prevname]]; else $aad[] = ['prev'=>null]; + if($nextid) $aad[] = ['next'=>[$nextid=>$nextname]]; else $aad[] = ['next'=>null]; + } + for($i=1;$i$title, 'url'=>$aab, 'explorer'=>$aac, 'prevnext'=>$aad); + echo json_encode($aaaa); + } + else + echo $title.PHP_EOL.implode(PHP_EOL, $aab); + }