This repository has been archived on 2023-10-01. You can view files and clone it, but cannot push or open issues or pull requests.
PyNyaaTa/pynyaata/connectors/__init__.py

30 lines
788 B
Python

from asyncio import gather
from .animeultime import AnimeUltime
from .core import Other
from .nyaa import Nyaa
from .yggtorrent import YggTorrent, YggAnimation
from ..config import CLOUDPROXY_ENDPOINT
async def run_all(*args, **kwargs):
coroutines = [Nyaa(*args, **kwargs).run(),
AnimeUltime(*args, **kwargs).run()]
if CLOUDPROXY_ENDPOINT:
coroutines.extend([YggTorrent(*args, **kwargs).run(),
YggAnimation(*args, **kwargs).run()])
return list(await gather(*coroutines))
def get_instance(url, query=''):
if 'nyaa.si' in url:
return Nyaa(query)
elif 'anime-ultime' in url:
return AnimeUltime(query)
elif 'ygg' in url:
return YggTorrent(query)
else:
return Other(query)