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)