diff --git a/src/Parser/User/Profile/UserProfileParser.php b/src/Parser/User/Profile/UserProfileParser.php index 411cd168..3769678f 100644 --- a/src/Parser/User/Profile/UserProfileParser.php +++ b/src/Parser/User/Profile/UserProfileParser.php @@ -125,7 +125,9 @@ public function getLastOnline(): ?\DateTimeImmutable */ public function getGender(): ?string { - $gender = $this->crawler->filterXPath('//span[contains(text(), \'Gender\')]/following-sibling::span'); + $gender = $this->crawler + ->filterXPath('//ul[contains(@class, "user-status")]/li/span[contains(text(), "Gender")]/following-sibling::span'); + if (!$gender->count()) { return null; } @@ -156,7 +158,9 @@ public function getBirthday(): ?\DateTimeImmutable */ public function getLocation(): ?string { - $gender = $this->crawler->filterXPath('//span[contains(text(), \'Location\')]/following-sibling::span'); + $gender = $this->crawler + ->filterXPath('//ul[contains(@class, "user-status")]/li/span[contains(text(), "Location")]/following-sibling::span'); + if (!$gender->count()) { return null; }