Skip to content

Commit

Permalink
user profile: fix gender & location parsing when it's not set by the …
Browse files Browse the repository at this point in the history
…user #358 2.x
  • Loading branch information
irfan-dahir committed Sep 10, 2021
1 parent 69356cc commit 1a6b9b9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Parser/User/Profile/UserProfileParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 1a6b9b9

Please sign in to comment.