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

26 lines
632 B
Python
Raw Permalink Normal View History

2023-01-04 15:57:16 +00:00
from asyncio import create_task, gather
from typing import List
2023-06-04 15:53:29 +00:00
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
2023-01-04 15:57:16 +00:00
BRIDGES: List[Bridge] = [
Nyaa(),
EraiRaws(),
YggTorrent(),
YggAnimation(),
AnimeUltime(),
]
async def search_all(query: str = "", page: int = 1) -> List[RemoteFile]:
tasks = []
2023-01-01 23:44:48 +00:00
2023-01-04 15:57:16 +00:00
for bridge in BRIDGES:
tasks.append(create_task(bridge.search(query, page)))
2023-01-01 23:44:48 +00:00
2023-01-04 23:49:54 +00:00
return await gather(*tasks, return_exceptions=True)