Sync Scraper

Scraper Module

This is the Synchronus version of KunYu() class.

This module contains the SyncKunYu() class, which acts as the primary entry point for interacting with Myanimelist data, as well as helper classes and functions.

Classes

SyncKunYu([use_cache, db_path, timeout])

The main Class for interacting with MAL Synchronusly.

class AnimeScraper.SyncScraper.SyncKunYu(use_cache: bool = False, db_path: str = 'cache.db', timeout: int = 10)[source]

Bases: object

The main Class for interacting with MAL Synchronusly.

__init__(use_cache: bool = False, db_path: str = 'cache.db', timeout: int = 10) None[source]

If you want to cache the data locally pass use_cache=True and specify the database path where you want to cache db_path='cache.db'. It uses sqlite3 for storing data.

Parameters:
  • use_cache (bool) – If data should be cached. (Default: False)

  • db_path – (str): The path of the database. (Default: cache.db)

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:

Anime

Example

>>> from AnimeScraper import SyncKunYu
>>> scraper = SyncKunYu()
>>> anime = scraper.search_anime("dr stone")
>>> print(anime.title)
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:

Character

Example

>>> from AnimeScraper import SyncKunYu
>>> with SyncKunYu() as scraper:
>>>     character = scraper.search_character("Togashi Yuuta")
>>>     print(character.name)

Notes

You can use with SyncKunYu context manager for same session use.

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:

Anime

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:

Character

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]

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]

search_batch_anime(anime_names: List[str]) List[Anime][source]

Fetches anime details in batch. :param anime_names: List of anime names. :type anime_names: List(str)

Returns:

A list of Anime objects with Anime details.

Return type:

List[Anime]

search_batch_character(character_names: List[str]) List[Character][source]

Fetches character details in batch. :param character_names: List of characters name. :type character_names: List(str)

Returns:

A list of Character objects with character’s details.

Return type:

List[Character]

top_anime_list(sort_by: str | None = None) List[Dict[str, str]][source]

Fetches Top Anime List From MAL. returns top anime list by popularity, rates etc.

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]]