From ab6d59a4c327877b85505a9606638decd1274177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20S=C3=A1nchez=20Calvo?= Date: Sun, 7 Apr 2024 17:54:21 +0200 Subject: [PATCH] [FIX]: Arreglado anime_info sin synopsis --- .gitignore | 5 ++++- animeflv/animeflv.py | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 05a1707..e0d553e 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,7 @@ target/ .idea/ # Sublime Text 2 -*.sublime* \ No newline at end of file +*.sublime* + +# Virtualenv +.venv \ No newline at end of file diff --git a/animeflv/animeflv.py b/animeflv/animeflv.py index 43b9154..cd68ae1 100644 --- a/animeflv/animeflv.py +++ b/animeflv/animeflv.py @@ -286,6 +286,10 @@ def get_anime_info(self, id: str) -> AnimeInfo: response = self._scraper.get(f"{ANIME_URL}/{id}") soup = BeautifulSoup(response.text, "lxml") + synopsis = soup.select_one( + "body div div div div div main section div.Description p" + ).string + information = { "title": soup.select_one( "body div.Wrapper div.Body div div.Ficha.fchlt div.Container h1.Title" @@ -295,9 +299,7 @@ def get_anime_info(self, id: str) -> AnimeInfo: + soup.select_one( "body div div div div div aside div.AnimeCover div.Image figure img" ).get("src", ""), - "synopsis": soup.select_one( - "body div div div div div main section div.Description p" - ).string.strip(), + "synopsis": synopsis.strip() if synopsis else None, "rating": soup.select_one( "body div div div.Ficha.fchlt div.Container div.vtshr div.Votes span#votes_prmd" ).string,