diff --git a/readme.md b/readme.md index 4d5b0d6d..fefa8611 100755 --- a/readme.md +++ b/readme.md @@ -37,7 +37,7 @@ A REST API service is available as well ### Wrappers - **[.NET]** [Jikan.net](https://github.com/Ervie/jikan.net) by Ervie -- **[Python]** [JikanPy](https://github.com/AWConant/jikanpy) by Andrew Conant & Abhinav Kasamsetty +- **[Python]** [JikanPy](https://github.com/abhinavk99/jikanpy) by Abhinav Kasamsetty - **[Ruby]** [Jikan.rb](https://github.com/Zerocchi/jikan.rb) by Zerocchi - **[JavaScript]** [JikanJS](https://github.com/zuritor/jikanjs) by Zuritor - **[Java]** [Jikan4java](https://github.com/Doomsdayrs/Jikan4java) by Doomsdayrs diff --git a/src/Parser/Search/CharacterSearchParser.php b/src/Parser/Search/CharacterSearchParser.php index 1fa74a33..80b35d0f 100644 --- a/src/Parser/Search/CharacterSearchParser.php +++ b/src/Parser/Search/CharacterSearchParser.php @@ -45,17 +45,8 @@ public function getModel(): CharacterSearch */ public function getResults(): array { - - if ($this->crawler->filterXPath('//div[@id="content"]/table/tr[2]/td') - // Yes, MAL actually has "probrems" - ->text() === 'There were some probrems:Must have at least 3 byte characters to search' - ) { - return []; - } - return $this->crawler - ->filterXPath('//div[@id="content"]/table/tr[1]') - ->nextAll() + ->filterXPath('//div[@id="content"]/table/tr') ->each( function (Crawler $c) { return (new CharacterSearchListItemParser($c))->getModel(); diff --git a/src/Parser/User/Profile/AnimeStatsParser.php b/src/Parser/User/Profile/AnimeStatsParser.php index 81680924..15547c40 100644 --- a/src/Parser/User/Profile/AnimeStatsParser.php +++ b/src/Parser/User/Profile/AnimeStatsParser.php @@ -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]'); diff --git a/src/Parser/User/Profile/MangaStatsParser.php b/src/Parser/User/Profile/MangaStatsParser.php index 224c45f1..34339935 100644 --- a/src/Parser/User/Profile/MangaStatsParser.php +++ b/src/Parser/User/Profile/MangaStatsParser.php @@ -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]');