Skip to content

Commit

Permalink
[User profile] fix mean score value not parsing #274 [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
Irfan committed Apr 1, 2020
1 parent 1dcefee commit 3a10a26
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Parser/User/Profile/AnimeStatsParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ public function getDaysWatched(): ?float
*/
public function getMeanScore(): ?float
{
$node = $this->crawler
->filterXPath(
'//*[@id="statistics"]/div[contains(@class, "user-statistics-stats")][1]
/div[contains(@class, "stats anime")]/div[1]/div[2]/span[contains(@class, "score-label")]'
);

if ($node->count()) {
return (float) $node->text();
}

$node = $this->crawler
->filterXPath('//div[@class=\'di-tc ar pr8 fs12 fw-b\'][1]');
Expand Down
10 changes: 10 additions & 0 deletions src/Parser/User/Profile/MangaStatsParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ public function getDaysRead(): ?float
*/
public function getMeanScore(): ?float
{
$node = $this->crawler
->filterXPath(
'//*[@id="statistics"]/div[contains(@class, "user-statistics-stats")][2]
/div[contains(@class, "stats manga")]/div[1]/div[2]/span[contains(@class, "score-label")]'
);

if ($node->count()) {
return (float) $node->text();
}

$node = $this->crawler
->filterXPath('//div[@class=\'di-tc ar pr8 fs12 fw-b\'][2]');
Expand Down

0 comments on commit 3a10a26

Please sign in to comment.