Added:
- Refactor MangaScraperService (not used everywhere now) - Added JavascriptScraper.php - Added alternatives slugs in Manga.php - Improvement in manga edit form
This commit is contained in:
28
src/Service/Scraper/MangaScraperService.php
Normal file
28
src/Service/Scraper/MangaScraperService.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\Scraper;
|
||||
|
||||
use App\Entity\Chapter;
|
||||
use App\Entity\ContentSource;
|
||||
|
||||
class MangaScraperService
|
||||
{
|
||||
private ScraperFactory $scraperFactory;
|
||||
|
||||
public function __construct(ScraperFactory $scraperFactory)
|
||||
{
|
||||
$this->scraperFactory = $scraperFactory;
|
||||
}
|
||||
|
||||
public function scrapeChapter(Chapter $chapter, ContentSource $contentSource): array|bool
|
||||
{
|
||||
$scraper = $this->scraperFactory->createScraper($contentSource);
|
||||
return $scraper->scrapeChapter($chapter, $contentSource);
|
||||
}
|
||||
|
||||
public function testScraping(string $mangaSlug, string $chapterNumber, ContentSource $contentSource): array
|
||||
{
|
||||
$scraper = $this->scraperFactory->createScraper($contentSource);
|
||||
return $scraper->testScraping($mangaSlug, $chapterNumber, $contentSource);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user