This repository has been archived by the owner on Jul 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtool.py
34 lines (24 loc) · 1.59 KB
/
tool.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# (c) @AbirHasan2005 & Hemanta Pokharel & The Anon Cat
import aiohttp
from configs import Config
from requests.utils import requote_uri
API_1337x = "https://api.abirhasan.wtf/1337x?query={}&limit={}"
API_YTS = "https://api.abirhasan.wtf/yts?query={}&limit={}"
API_PIRATEBAY = "https://api.abirhasan.wtf/piratebay?query={}&limit={}"
API_ANIME = "https://api.abirhasan.wtf/anime?query={}&limit={}"
async def Search1337x(query: str):
async with aiohttp.ClientSession() as session:
async with session.get(requote_uri(API_1337x.format(query, Config.MAX_INLINE_RESULTS))) as res:
return (await res.json())["results"] if ((await res.json()).get("results", None) is not None) else []
async def SearchYTS(query: str):
async with aiohttp.ClientSession() as session:
async with session.get(requote_uri(API_YTS.format(query, Config.MAX_INLINE_RESULTS))) as res:
return (await res.json())["results"] if ((await res.json()).get("results", None) is not None) else []
async def SearchPirateBay(query: str):
async with aiohttp.ClientSession() as session:
async with session.get(requote_uri(API_PIRATEBAY.format(query, Config.MAX_INLINE_RESULTS))) as res:
return (await res.json())["results"] if ((await res.json()).get("results", None) is not None) else []
async def SearchAnime(query: str):
async with aiohttp.ClientSession() as session:
async with session.get(requote_uri(API_ANIME.format(query, Config.MAX_INLINE_RESULTS))) as res:
return (await res.json())["results"] if ((await res.json()).get("results", None) is not None) else []