diff --git a/nlightreader/parsers/combined/shikimori/shikimori_lib.py b/nlightreader/parsers/combined/shikimori/shikimori_lib.py index 99bc5a3..77e366d 100644 --- a/nlightreader/parsers/combined/shikimori/shikimori_lib.py +++ b/nlightreader/parsers/combined/shikimori/shikimori_lib.py @@ -134,7 +134,7 @@ def update_user_rate(self, user_rate: UserRate): @singleton class Auth: - def __init__(self, token=None, scope=None): + def __init__(self): self.client_id = SHIKIMORI_CLIENT_ID self.client_secret = SHIKIMORI_CLIENT_SECRET self.redirect_uri = "urn:ietf:wg:oauth:2.0:oob" @@ -146,7 +146,7 @@ def __init__(self, token=None, scope=None): self.headers = SHIKIMORI_HEADERS | { "Authorization": f"Bearer {self.tokens.get('access_token')}", } - self.client = self.get_client(scope, self.redirect_uri, token) + self.client = self.get_client("user_rates", self.redirect_uri, None) self.refresh_token() self.user: User = User(None, None, None) self.is_authorized = False @@ -157,7 +157,7 @@ def auth_login(self, params): self.fetch_token(params["token"]) self.check_auth() - def get_client(self, scope, redirect_uri, token): + def get_client(self, scope, redirect_uri, token: dict | None): client = OAuth2Session( self.client_id, auto_refresh_url=URL_SHIKIMORI_TOKEN, diff --git a/nlightreader/parsers/hentai_manga/allhentai_hmanga.py b/nlightreader/parsers/hentai_manga/allhentai_hmanga.py index bcb88c3..85dd469 100644 --- a/nlightreader/parsers/hentai_manga/allhentai_hmanga.py +++ b/nlightreader/parsers/hentai_manga/allhentai_hmanga.py @@ -36,7 +36,9 @@ def search_manga(self, form): manga_id = base_info.get("href") name = base_info.get("title") if manga_id and name: - mangas.append(Manga(manga_id, self.CATALOG_ID, name, "")) + mangas.append( + Manga(manga_id, self.CATALOG_ID, name, ""), + ) return mangas def get_chapters(self, manga: Manga): diff --git a/nlightreader/parsers/manga/mangadex_manga.py b/nlightreader/parsers/manga/mangadex_manga.py index edfd5d2..fe6e19c 100644 --- a/nlightreader/parsers/manga/mangadex_manga.py +++ b/nlightreader/parsers/manga/mangadex_manga.py @@ -187,10 +187,14 @@ def get_preview(self, manga: Manga): def get_genres(self): url = f"{self.url_api}/manga/tag" - html = get_html(url, headers=self.headers) + response = get_html( + url, + headers=self.headers, + content_type="json", + ) genres = [] - if html and html.status_code == 200 and html.json(): - for i in html.json().get("data"): + if response: + for i in response.get("data"): if i.get("attributes").get("group") not in ["genre", "theme"]: continue genres.append(