- ContentSource handling in message
- ContentSource list, add/update ui
- nextPageSelector and imageSelector can be null
- cleanup
This commit is contained in:
Jérémy Guillot
2024-06-30 20:47:27 +02:00
parent ba30d3102d
commit 3012adfee7
24 changed files with 762 additions and 707 deletions

View File

@@ -5,8 +5,7 @@ namespace App\MessageHandler;
use App\Entity\ContentSource;
use App\Message\DownloadChapter;
use App\Repository\ChapterRepository;
use App\Repository\MangaRepository;
use App\Service\LelScansProviderService;
use App\Repository\ContentSourceRepository;
use App\Service\MangaScraperService;
use App\Service\NotificationService;
use Exception;
@@ -20,7 +19,8 @@ readonly class DownloadChapterHandler
public function __construct(
private ChapterRepository $chapterRepository,
private MangaScraperService $mangaScraperService,
private NotificationService $notificationService
private NotificationService $notificationService,
private ContentSourceRepository $contentSourceRepository
)
{
@@ -40,21 +40,27 @@ readonly class DownloadChapterHandler
throw new BadRequestHttpException('Chapter already downloaded');
}
$sources = [
(new ContentSource())
->setBaseUrl('https://lelscans.net')
->setImageSelector('#image img')
->setChapterUrlFormat('https://lelscans.net/scan-%s/%s')
->setNextPageSelector('a[title="Suivant"]')
->setScrapingType('html'),
$sources = $this->contentSourceRepository->findAll();
$sources[] =
(new ContentSource())
->setBaseUrl('https://api.mangadex.org/')
->setImageSelector('img')
->setChapterUrlFormat('at-home/server/%s')
->setScrapingType('mangadex')
];
;
// (new ContentSource())
// ->setBaseUrl('https://lelscans.net')
// ->setImageSelector('#image img')
// ->setChapterUrlFormat('https://lelscans.net/scan-%s/%s')
// ->setNextPageSelector('a[title="Suivant"]')
// ->setScrapingType('html'),
// (new ContentSource())
// ->setBaseUrl('https://darkscans.net/')
// ->setImageSelector('.reading-content img')
// ->setChapterUrlFormat('https://darkscans.net/mangas/%s/chapter-%s/')
// ->setNextPageSelector(null)
// ->setScrapingType('html')
$scrapedSuccessfully = false;