-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtool.py
More file actions
42 lines (30 loc) · 1.91 KB
/
tool.py
File metadata and controls
42 lines (30 loc) · 1.91 KB
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
35
36
37
38
39
40
41
42
# (c) @AbirHasan2005
# Scrappers
import aiohttp
from configs import Config
from requests.utils import requote_uri
API_1337x = "https://api.abir-hasan.tk/1337x?query={}&limit={}"
API_YTS = "https://api.abir-hasan.tk/yts?query={}&limit={}"
API_PIRATEBAY = "https://api.abir-hasan.tk/piratebay?query={}&limit={}"
API_ANIME = "https://api.abir-hasan.tk/anime?query={}&limit={}"
API_PYPI = "https://api.abir-hasan.tk/pypi?query="
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 []
async def SearchPyPi(query: str):
async with aiohttp.ClientSession() as session:
async with session.get(requote_uri(API_PYPI.format(query, Config.MAX_INLINE_RESULTS))) as res:
return (await res.json())["results"] if ((await res.json()).get("results", None) is not None) else []