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/pynyaata2/bridge/__init__.py
2023-06-04 17:53:29 +02:00

26 lines
632 B
Python

from asyncio import create_task, gather
from typing import List
from pynyaata2.bridge.animeultime import AnimeUltime
from pynyaata2.bridge.nyaa import EraiRaws, Nyaa
from pynyaata2.bridge.yggtorrent import YggAnimation, YggTorrent
from pynyaata2.types import Bridge, RemoteFile
BRIDGES: List[Bridge] = [
Nyaa(),
EraiRaws(),
YggTorrent(),
YggAnimation(),
AnimeUltime(),
]
async def search_all(query: str = "", page: int = 1) -> List[RemoteFile]:
tasks = []
for bridge in BRIDGES:
tasks.append(create_task(bridge.search(query, page)))
return await gather(*tasks, return_exceptions=True)