Skip to content

Commit

Permalink
v2: fix #366 [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
irfan-dahir committed Nov 12, 2021
1 parent 1a8e0ab commit dd51335
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Parser/Anime/AnimeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,13 @@ public function getBackground(): ?string
*/
public function getOpeningThemes(): array
{
return $this->crawler->filterXPath('//div[@class="theme-songs js-theme-songs opnening"]/table/tr')
$node = $this->crawler->filterXPath('//div[@class="theme-songs js-theme-songs opnening"]/table/tr');

if (preg_match('~No opening themes have been added to this title~', $node->text())) {
return [];
}

return $node
->each(function (Crawler $crawler) {
return JString::cleanse($crawler->text());
});
Expand All @@ -736,7 +742,13 @@ public function getOpeningThemes(): array
*/
public function getEndingThemes(): array
{
return $this->crawler->filterXPath('//div[@class="theme-songs js-theme-songs ending"]/table/tr')
$node = $this->crawler->filterXPath('//div[@class="theme-songs js-theme-songs ending"]/table/tr');

if (preg_match('~No ending themes have been added to this title~', $node->text())) {
return [];
}

return $node
->each(function (Crawler $crawler) {
return JString::cleanse($crawler->text());
});
Expand Down

0 comments on commit dd51335

Please sign in to comment.