Added:
- Updated Reader - fix image download for JavascriptScraper.php
This commit is contained in:
@@ -5,10 +5,14 @@ namespace App\Service\Scraper;
|
||||
use App\Entity\Chapter;
|
||||
use App\Entity\ContentSource;
|
||||
use Exception;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Symfony\Component\Panther\Client as PantherClient;
|
||||
|
||||
class JavascriptScraper extends AbstractScraper
|
||||
{
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function scrapeChapter(Chapter $chapter, ContentSource $contentSource): array|bool
|
||||
{
|
||||
$manga = $chapter->getManga();
|
||||
@@ -36,7 +40,7 @@ class JavascriptScraper extends AbstractScraper
|
||||
$imageName = sprintf('%03d.%s', $index + 1, pathinfo(parse_url($page['image_url'], PHP_URL_PATH), PATHINFO_EXTENSION));
|
||||
$imagePath = $tempDir . '/' . $imageName;
|
||||
|
||||
file_put_contents($imagePath, file_get_contents($page['image_url']));
|
||||
$this->downloadAndSaveImage($page['image_url'], $imagePath);
|
||||
$this->dispatchProgressEvent($chapter, $index + 1, count($pageData));
|
||||
|
||||
$page['local_image_url'] = $imagePath;
|
||||
@@ -52,9 +56,6 @@ class JavascriptScraper extends AbstractScraper
|
||||
$this->cleanupTempFiles($tempDir);
|
||||
|
||||
return $pageData;
|
||||
} catch (Exception $e) {
|
||||
// Log the error
|
||||
return false;
|
||||
} finally {
|
||||
$pantherClient->close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user