Skip to content

Commit

Permalink
Use alpine for docker image + add hentai-comics.org Driver
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymoulin committed Sep 28, 2017
1 parent f227362 commit 29b26ba
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Here's is the list of supported sites for now:
* hentai2read.com
* hentaibox.net
* hentaicomics.pro
* hentai-comics.org
* hentaifox.com
* hentaifromhell.org
* hentai-paradise.fr
Expand Down
7 changes: 4 additions & 3 deletions docker/pc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM php:7.0-cli
FROM php:7.0-fpm-alpine
COPY . /root
WORKDIR /root
ENV PATH="/root:$PATH"

RUN apt-get update && apt-get install git zip wget -y && \
RUN apk add git zip --update --no-cache && \
apk add wget --virtual .build-deps && \
wget https://raw.githubusercontent.com/composer/getcomposer.org/1b137f8bf6db3e79a38a5bc45324414a6b1f9df2/web/installer -O - -q | php -- --quiet && \
php composer.phar install --no-dev -o && \
apt-get remove wget -y
apk del wget --purge .build-deps

VOLUME ['/root/downloads']

Expand Down
39 changes: 39 additions & 0 deletions src/Driver/HentaiComics.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Yamete\Driver;

class HentaiComics extends \Yamete\DriverAbstract
{
private $aMatches = [];
const DOMAIN = 'hentai-comics.org';

public function canHandle()
{
return preg_match(
'~^https?://' . strtr(self::DOMAIN, ['.' => '\.', '-' => '\-']) .
'/gallery/(?<id>[^/]+)/(?<album>.+)\.html$~',
$this->sUrl,
$this->aMatches
);
}

public function getDownloadables()
{
$sFirstPage = "https://" . self::DOMAIN . "/view/{$this->aMatches['id']}/1/{$this->aMatches['album']}.html";
$oRes = $this->getClient()->request('GET', $sFirstPage);
$aReturn = [];
if (preg_match('~var d=(?<json>[^;]+);~', (string)$oRes->getBody(), $aMatches)) {
foreach (\GuzzleHttp\json_decode($aMatches['json'], true) as $aOption) {
$sFilename = $aOption['chapter_image'];
$sBasename = $this->getFolder() . DIRECTORY_SEPARATOR . basename($sFilename);
$aReturn[$sBasename] = $sFilename;
}
}
return $aReturn;
}

private function getFolder()
{
return implode(DIRECTORY_SEPARATOR, [self::DOMAIN, $this->aMatches['album']]);
}
}

0 comments on commit 29b26ba

Please sign in to comment.