Skip to content

Commit

Permalink
fixes #18 - encode special quotes for myhentaigallery.com
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymoulin committed Nov 24, 2019
1 parent e5a4e97 commit efb32a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Driver/MyHentaiGallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ public function getDownloadables(): array
/**
* @var \PHPHtmlParser\Dom\AbstractNode $oImg
*/
$sFilename = str_replace('/thumbnail/', '/original/', $oImg->getAttribute('src'));
$sFilename = html_entity_decode(
str_replace('/thumbnail/', '/original/', $oImg->getAttribute('src')),
ENT_QUOTES
);
$iPos = strpos($sFilename, '?');
if ($iPos) {
$sFilename = substr($sFilename, 0, $iPos);
Expand Down
12 changes: 12 additions & 0 deletions tests/Driver/MyHentaiGallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,16 @@ public function testDownload()
$this->assertTrue($driver->canHandle());
$this->assertEquals(53, count($driver->getDownloadables()));
}

/**
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function testDownloadSpecial()
{
$url = 'https://myhentaigallery.com/gallery/thumbnails/14053';
$driver = new \Yamete\Driver\MyHentaiGallery();
$driver->setUrl($url);
$this->assertTrue($driver->canHandle());
$this->assertEquals(21, count($driver->getDownloadables()));
}
}

0 comments on commit efb32a7

Please sign in to comment.