Base classes

anime.py contains the base classes required for other anime classes.

anime_downloader.sites.init.get_anime_class(url)[source]

Get anime class corresposing to url or name. See anime_downloader.sites.ALL_ANIME_SITES to get the possible anime sites.

Parameters:url (string) – URL of the anime.
Returns:Concrete implementation of anime_downloader.sites.anime.Anime
Return type:anime_downloader.sites.anime.Anime
anime_downloader.commands.dl.sitenames = ['9anime', 'gogoanime', 'kissanime', 'kisscartoon', 'twist.moe', 'animepahe', 'anistream', 'animeflv', 'itsaturday']

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

class anime_downloader.sites.anime.Anime(url=None, quality='720p', fallback_qualities=None, _skip_online_data=False)[source]

Base class for all anime classes.

Parameters:
  • url (string) – URL of the anime.
  • quality (One of ['360p', '480p', '720p', '1080p']) – Quality of episodes
  • fallback_qualities (list) – The order of fallback.
sitename

name of the site

Type:str
title

Title of the anime

Type:str
meta

metadata about the anime. [Can be empty]

Type:dict
QUALITIES

Possible qualities for the site

Type:list
_scrape_metadata()[source]

_scrape_metadata is function which has to be overridden by the base classes to scrape the metadata of anime from the web page.

Parameters:soup (bs4.BeautifulSoup) – soup is the html of the anime url after passing through BeautifulSoup.
get_data()[source]

get_data is called inside the __init__ of BaseAnime. It is used to get the necessary data about the anime and it’s episodes.

This function calls _scarpe_episodes and _scrape_metadata

TODO: Refactor this so that classes which need not be soupified don’t have to overload this function.

Returns:A list of tuples of episodes containing episode name and episode url. Ex:
[('1', 'https://9anime.is/.../...', ...)]
Return type:list
classmethod search(query)[source]

Search searches for the anime using the query given.

Parameters:query (str) – query is the query keyword to be searched.
Returns:List of SearchResult
Return type:list
class anime_downloader.sites.anime.AnimeEpisode(url, parent: anime_downloader.sites.anime.Anime = None, ep_no=None)[source]

Base class for all Episode classes.

Parameters:
  • url (string) – URL of the episode.
  • quality (One of ['360p', '480p', '720p', '1080p']) – Quality of episode
  • fallback_qualities (list) – The order of fallback.
sitename

name of the site

Type:str
title

Title of the anime

Type:str
meta

metadata about the anime. [Can be empty]

Type:dict
ep_no

Episode number/title of the episode

Type:string
pretty_title

Pretty title of episode in format <animename>-<ep_no>

Type:string
download(force=False, path=None, format='{anime_title}_{ep_no}', range_size=None)[source]

Downloads episode. This might be removed in a future release.

Parameters:
  • force (bool) – Whether to force download or not.
  • path (string) – Path to the directory/file where the file should be downloaded to.
  • format (string) – The format of the filename if not provided.
source(index=0)[source]

Get the source for episode

Returns:Extractor depending on the source.
Return type:anime_downloader.extractors.base_extractor.BaseExtractor
class anime_downloader.sites.anime.SearchResult(title, url, poster='', meta='')[source]

SearchResult class holds the search result of a search done by an Anime class

Parameters:
  • title (str) – Title of the anime.
  • url (str) – URL of the anime
  • poster (str) – URL for the poster of the anime.
  • meta (dict) – Additional metadata regarding the anime.
title

Title of the anime.

Type:str
url

URL of the anime

Type:str
poster

URL for the poster of the anime.

Type:str
meta

Additional metadata regarding the anime.

Type:dict