diff --git a/src/Parser/User/Profile/FavoritesParser.php b/src/Parser/User/Profile/FavoritesParser.php index 7bf5324a..2a5257b6 100644 --- a/src/Parser/User/Profile/FavoritesParser.php +++ b/src/Parser/User/Profile/FavoritesParser.php @@ -2,6 +2,7 @@ namespace Jikan\Parser\User\Profile; +use Jikan\Helper\Constants; use Jikan\Helper\Parser; use Jikan\Model\Common\AnimeMeta; use Jikan\Model\Common\CharacterMeta; @@ -48,14 +49,14 @@ public function getModel(): Favorites */ public function getAnime(): array { - return $this->crawler->filterXPath('//ul[@class=\'favorites-list anime\']/li') + return $this->crawler->filterXPath('//div[@id=\'anime_favorites\']/div[@class=\'fav-slide-outer\']/ul/li') ->each( function (Crawler $crawler) { return new AnimeMeta( - $crawler->filterXPath('//div[position() = 2]/a')->text(), - $crawler->filterXPath('//div[position() = 2]/a')->attr('href'), - Parser::parseImageQuality($crawler->filterXPath('//div[position() = 1]/a/img') - ->attr('src')) + $crawler->filterXPath('//a/span[contains(@class, \'title\')]')->text(), + $crawler->filterXPath('//a')->attr('href'), + Parser::parseImageQuality($crawler->filterXPath('//a/img') + ->attr('data-src')), ); } ); @@ -67,14 +68,14 @@ function (Crawler $crawler) { */ public function getManga(): array { - return $this->crawler->filterXPath('//ul[@class=\'favorites-list manga\']/li') + return $this->crawler->filterXPath('//div[@id=\'manga_favorites\']/div[@class=\'fav-slide-outer\']/ul/li') ->each( function (Crawler $crawler) { return new MangaMeta( - $crawler->filterXPath('//div[position() = 2]/a')->text(), - $crawler->filterXPath('//div[position() = 2]/a')->attr('href'), - Parser::parseImageQuality($crawler->filterXPath('//div[position() = 1]/a/img') - ->attr('src')) + $crawler->filterXPath('//a/span[contains(@class, \'title\')]')->text(), + $crawler->filterXPath('//a')->attr('href'), + Parser::parseImageQuality($crawler->filterXPath('//a/img') + ->attr('data-src')), ); } ); @@ -86,14 +87,14 @@ function (Crawler $crawler) { */ public function getCharacters(): array { - return $this->crawler->filterXPath('//ul[@class=\'favorites-list characters\']/li') + return $this->crawler->filterXPath('//div[@id=\'character_favorites\']/div[@class=\'fav-slide-outer\']/ul/li') ->each( function (Crawler $crawler) { return new CharacterMeta( - $crawler->filterXPath('//div[position() = 2]/a')->text(), - $crawler->filterXPath('//div[position() = 2]/a')->attr('href'), - Parser::parseImageQuality($crawler->filterXPath('//div[position() = 1]/a/img') - ->attr('src')) + $crawler->filterXPath('//a/span[contains(@class, \'title\')]')->text(), + Constants::BASE_URL.$crawler->filterXPath('//a')->attr('href'), + Parser::parseImageQuality($crawler->filterXPath('//a/img') + ->attr('data-src')), ); } ); @@ -105,14 +106,14 @@ function (Crawler $crawler) { */ public function getPeople(): array { - return $this->crawler->filterXPath('//ul[@class=\'favorites-list people\']/li') + return $this->crawler->filterXPath('//div[@id=\'person_favorites\']/div[@class=\'fav-slide-outer\']/ul/li') ->each( function (Crawler $crawler) { return new PersonMeta( - $crawler->filterXPath('//div[position() = 2]/a')->text(), - $crawler->filterXPath('//div[position() = 2]/a')->attr('href'), - Parser::parseImageQuality($crawler->filterXPath('//div[position() = 1]/a/img') - ->attr('src')) + $crawler->filterXPath('//a/span[contains(@class, \'title\')]')->text(), + Constants::BASE_URL.$crawler->filterXPath('//a')->attr('href'), + Parser::parseImageQuality($crawler->filterXPath('//a/img') + ->attr('data-src')), ); } ); diff --git a/src/Parser/User/Profile/UserProfileParser.php b/src/Parser/User/Profile/UserProfileParser.php index 3769678f..e5885b06 100644 --- a/src/Parser/User/Profile/UserProfileParser.php +++ b/src/Parser/User/Profile/UserProfileParser.php @@ -217,7 +217,7 @@ public function getAbout(): ?string public function getFavorites(): Model\User\Favorites { // $node = $this->crawler->filterXPath('//ul[@class=\'favorites-list anime\']/li') - $node = $this->crawler->filterXPath('//div[contains(@class, \'user-favorites\')]'); + $node = $this->crawler->filterXPath('//div[contains(@class, \'container-right\')]'); return (new FavoritesParser($node))->getModel(); }