feat: refactorisation de la gestion du scraping des chapitres en remplaçant les identifiants de manga et de chapitre par un identifiant de chapitre unique, amélioration de la récupération des sources préférées et ajout de la gestion des erreurs pour les échecs de scraping.
This commit is contained in:
parent
e29433bb0c
commit
c9f1771522
@@ -22,7 +22,9 @@ class InMemorySourceRepository implements SourceRepositoryInterface
|
||||
[
|
||||
'imageSelector' => 'img.manga-image',
|
||||
'nextPageSelector' => null,
|
||||
'chapterUrlFormat' => 'https://example.com/manga/{slug}/chapter-{chapterNumber}'
|
||||
'chapterUrlFormat' => 'https://example.com/manga/{slug}/chapter-{chapterNumber}',
|
||||
'scrapingType' => 'html',
|
||||
'chapterSelector' => '.chapter-item'
|
||||
],
|
||||
true,
|
||||
new DateTimeImmutable(),
|
||||
@@ -30,13 +32,17 @@ class InMemorySourceRepository implements SourceRepositoryInterface
|
||||
);
|
||||
}
|
||||
|
||||
public function getById(string $id): Source
|
||||
public function getById(string $id): ?Source
|
||||
{
|
||||
if (!isset($this->sources[$id])) {
|
||||
throw new \RuntimeException('Source not found');
|
||||
}
|
||||
return $this->sources[$id] ?? null;
|
||||
}
|
||||
|
||||
return $this->sources[$id];
|
||||
/**
|
||||
* @return Source[]
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
return array_values($this->sources);
|
||||
}
|
||||
|
||||
public function save(Source $source): void
|
||||
|
||||
Reference in New Issue
Block a user