diff --git a/src/Lookup/EEPROMLookup.php b/src/Lookup/EEPROMLookup.php index 29d7c78..9a66613 100644 --- a/src/Lookup/EEPROMLookup.php +++ b/src/Lookup/EEPROMLookup.php @@ -15,10 +15,11 @@ final class EEPROMLookup implements \Uiharu\ILookup { ) {} public function match(Url $url): bool { + $urlHost = strtolower($url->getHost()); return $url->getScheme() === $this->protocol || ( $url->isWeb() && ( - in_array($url->getHost(), $this->shortDomains) || ( - $url->getHost() === $this->apiDomain && str_starts_with($url->getPath(), '/uploads') + in_array($urlHost, $this->shortDomains) || ( + $urlHost === $this->apiDomain && str_starts_with($url->getPath(), '/uploads') ) ) ); diff --git a/src/Lookup/NicoNicoLookup.php b/src/Lookup/NicoNicoLookup.php index 34ee137..f7d69f5 100644 --- a/src/Lookup/NicoNicoLookup.php +++ b/src/Lookup/NicoNicoLookup.php @@ -28,10 +28,12 @@ final class NicoNicoLookup implements \Uiharu\ILookup { if(!$url->isWeb()) return false; - if(self::isShortDomain($url->getHost())) + $urlHost = strtolower($url->getHost()); + + if(self::isShortDomain($urlHost)) return true; - if(self::isLongDomain($url->getHost()) && str_starts_with($url->getPath(), '/watch/sm')) + if(self::isLongDomain($urlHost) && str_starts_with($url->getPath(), '/watch/sm')) return true; return false; diff --git a/src/Lookup/TwitterLookup.php b/src/Lookup/TwitterLookup.php index 1acae8f..a139ddb 100644 --- a/src/Lookup/TwitterLookup.php +++ b/src/Lookup/TwitterLookup.php @@ -14,7 +14,7 @@ final class TwitterLookup implements \Uiharu\ILookup { ]; public function match(Url $url): bool { - if(!$url->isWeb() || !in_array($url->getHost(), self::TWITTER_DOMAINS)) + if(!$url->isWeb() || !in_array(strtolower($url->getHost()), self::TWITTER_DOMAINS)) return false; return preg_match('#^/@?(?:[A-Za-z0-9_]{1,20})/status(?:es)?/([0-9]+)/?$#', $url->getPath()) diff --git a/src/Lookup/YouTubeLookup.php b/src/Lookup/YouTubeLookup.php index 78c8f59..f005a3f 100644 --- a/src/Lookup/YouTubeLookup.php +++ b/src/Lookup/YouTubeLookup.php @@ -38,7 +38,7 @@ final class YouTubeLookup implements \Uiharu\ILookup { if(!$url->isWeb()) return false; - $urlHost = $url->getHost(); + $urlHost = strtolower($url->getHost()); if(self::isShortDomain($urlHost)) return true;