Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (19 sloc) 924 Bytes

Library usage

Anime downloader can be used as a library too.

The following code searches for 'one punch' from twist.moe

:py:func:`~anime_downloader.sites.init.get_anime_class` can be used to import specific sites using the url one of :py:data:`~anime_downloader.commands.dl.sitenames`.

from anime_downloader.sites import get_anime_class

Twist = get_anime_class('twist.moe')
search = Twist.search('one punch')
print(search[0].title)

# You can directly import twist too
from anime_downloader.sites.twistmoe import TwistMoe
anime = TwistMoe(search[0].url)
print(anime)
print(len(anime))

# Get first episodes url
print(anime[0].source().stream_url)

In the above example TwistMoe is a concrete implementation of :py:class:`anime_downloader.sites.anime.Anime`. Search results is list of :py:class:`anime_downloader.sites.anime.SearchResult`.

You can’t perform that action at this time.