Async Scraper¶
Scraper Module¶
Scraper: A module to fetch and parse data from MyAnimeList.
This module contains the KunYu() class, which acts as the primary entry point for interacting with Myanimelist data, as well as helper classes and functions.
Classes
|
The main class for interacting with MyAnimeList data. |
- class AnimeScraper.AsyncScraper.KunYu(use_cache: bool = False, db_path: str = 'cache.db', max_requests: int = 5, per_second: int = 1, timeout: int = 10)[source]¶
Bases:
objectThe main class for interacting with MyAnimeList data.
This class acts as the entry point for users of the library.
- __init__(use_cache: bool = False, db_path: str = 'cache.db', max_requests: int = 5, per_second: int = 1, timeout: int = 10) None[source]¶
Initial method.
- Parameters:
use_cache (bool) – If data should be cached. (Default: False)
db_path – (str): The path of the database. (Default: cache.db)
max_requests (int) – The number requests to make at per_second seconds. (Default: 5)
per_second (int) – number of seconds max_requests can be made. (Default: 1)
- async search_anime(anime_name: str) Anime[source]¶
Fetches and Returns Anime details from myanimelist.
- Parameters:
anime_name (str) – Name of the anime you want to search.
- Returns:
Returns Anime object with anime details.
- Return type:
- async search_character(character_name: str) Character[source]¶
Fetches and Returns Character details from myanimelist.
- Parameters:
character_name (str) – Name of the Character you want to search.
- Returns:
Returns Character object with the character details.
- Return type:
- async get_anime(anime_id: str) Anime[source]¶
Fetches anime details from MyAnimeList.
- Parameters:
anime_id (str) – The ID of the anime.
- Returns:
An object containing anime details.
- Return type:
- async get_character(character_id: str) Character[source]¶
Fetches character details from MyAnimeList.
- Parameters:
character_id (str) – The ID of the character.
- Returns:
An object containing character details.
- Return type:
- async get_batch_anime(anime_ids: List[str]) List[Anime][source]¶
Fetches multiple anime from the list of anime id.
- Parameters:
anime_ids (List[str]) – A list of anime id. (anime ID from Myanimelist)
- Returns:
A list of Anime object containing anime details.
- Return type:
List[Anime]
- async get_batch_character(character_ids: List[str]) List[Character][source]¶
Fetches multiple character from the list of character id.
- Parameters:
character_ids (List[str]) – A list of character id. (character ID from Myanimelist)
- Returns:
A list of Character object containing character details.
- Return type:
List[Character]
- async search_batch_anime(anime_names: List) List[Anime][source]¶
Fetches multiple anime in batch.
- Parameters:
anime_names (List) – List of anime names.
- Returns:
Returns a list of Anime class object with anime details.
- Return type:
List[Anime]
- async search_batch_character(character_names: List) List[Character][source]¶
Fetches multiple characters in batch.
- Parameters:
character_names (List) – List of characters name.
- Returns:
Returns a list of Character class object with characters details.
- Return type:
List[Character]
- async top_anime_list(sort_by: str | None = None) List[Dict[str, str]][source]¶
Fetches Top Anime List From MAL.
- Parameters:
sort_by (str) – Sort by ‘bypopularity’, ‘favorite’, ‘tv’, ‘movie’, ‘airing’, ‘upcoming’, ‘ova’ etc.
- Returns:
Returns a list/array of dictionary with anime name, img, url
- Return type:
List[Dict[str, str]]