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

27 lines
699 B
Python
Raw Permalink Normal View History

2021-01-03 19:41:58 +00:00
from asyncio import gather
2020-04-24 19:01:44 +00:00
from .animeultime import AnimeUltime
from .core import Other
from .nyaa import Nyaa
2022-12-21 14:53:50 +00:00
from .yggtorrent import YggAnimation, YggTorrent
2020-04-24 19:01:44 +00:00
2021-01-03 19:41:58 +00:00
async def run_all(*args, **kwargs):
2021-01-07 20:19:50 +00:00
coroutines = [Nyaa(*args, **kwargs).run(),
2021-12-07 10:17:01 +00:00
AnimeUltime(*args, **kwargs).run(),
YggTorrent(*args, **kwargs).run(),
YggAnimation(*args, **kwargs).run()]
2021-01-07 20:19:50 +00:00
return list(await gather(*coroutines))
2020-04-24 19:01:44 +00:00
2021-01-30 18:40:36 +00:00
def get_instance(url, query=''):
2020-04-24 19:01:44 +00:00
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)