diff --git a/src/Helper/Constants.php b/src/Helper/Constants.php index 5be22ff9..158a81d9 100644 --- a/src/Helper/Constants.php +++ b/src/Helper/Constants.php @@ -12,6 +12,7 @@ class Constants { public const BASE_URL = 'https://myanimelist.net'; + public const CDN_URL = 'https://cdn.myanimelist.net'; public const SEASONS = [ 'Winter', diff --git a/src/Parser/Club/UserProfileParser.php b/src/Parser/Club/UserProfileParser.php index b862cf26..1dd34a8c 100644 --- a/src/Parser/Club/UserProfileParser.php +++ b/src/Parser/Club/UserProfileParser.php @@ -63,7 +63,11 @@ public function getImage(): string $this->crawler->filterXPath('//img[1]')->attr('data-src') ); - if (!preg_match("~^".Constants::BASE_URL."~", $imageUrl)) { + if (str_contains($imageUrl, Constants::CDN_URL)) { + return $imageUrl; + } + + if (!str_contains($imageUrl, Constants::BASE_URL)) { $imageUrl = Constants::BASE_URL.$imageUrl; }