Skip to content

Commit

Permalink
hotfix: anime/manga relations. skip empty "entry boxes"
Browse files Browse the repository at this point in the history
  • Loading branch information
irfan-dahir committed May 30, 2024
1 parent 81ce30c commit fcc8d20
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/Parser/Anime/AnimeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,14 @@ public function getRelated(): array
->filterXPath('//div[contains(@class, "related-entries")]/div[contains(@class, "entries-tile")]/div[contains(@class, "entry")]')
->each(
function (Crawler $c) use (&$related) {
$relation = $c->filterXPath('//div[@class="content"]/div[@class="relation"]')->text();
$relation = $c->filterXPath('//div[@class="content"]/div[@class="relation"]');

// skips empty entry boxes
if (!$relation->count()) {
return;
}

$relation = $relation->text();

// strip entry type (if any)
$relation = JString::cleanse(
Expand Down
9 changes: 8 additions & 1 deletion src/Parser/Manga/MangaParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,14 @@ public function getMangaRelated(): array
->filterXPath('//div[contains(@class, "related-entries")]/div[contains(@class, "entries-tile")]/div[contains(@class, "entry")]')
->each(
function (Crawler $c) use (&$related) {
$relation = $c->filterXPath('//div[@class="content"]/div[@class="relation"]')->text();
$relation = $c->filterXPath('//div[@class="content"]/div[@class="relation"]');

// skips empty entry boxes
if (!$relation->count()) {
return;
}

$relation = $relation->text();

// strip entry type (if any)
$relation = JString::cleanse(
Expand Down

0 comments on commit fcc8d20

Please sign in to comment.