1
0
Fork 0

Add xrel p2p predb

This commit is contained in:
Casper V. Kristensen 2022-06-27 20:21:20 +02:00
parent 1a0f0349c8
commit b75ce6822b

View file

@ -18,7 +18,7 @@ def get_pres() -> List[Pre]:
logger.info("Getting pres from predbs")
# PreDBs in order of preference
predbs = (get_xrel, get_predbde, get_predbovh)
predbs = (get_xrel, get_xrel_p2p, get_predbde, get_predbovh)
pres = {}
for get in reversed(predbs):
try:
@ -59,6 +59,27 @@ def get_xrel(categories=("CRACKED", "UPDATE"), num_pages=2) -> List[Pre]:
]
def get_xrel_p2p() -> List[Pre]:
logger.debug("Getting P2P pres from xrel.to")
r = cache.get(
"https://api.xrel.to/v2/p2p/releases.json",
params={
"category_id": "015d9c029", # game
"per_page": 100,
},
)
return [
Pre(
dirname=rls["dirname"],
nfo_link=rls["link_href"],
timestamp=datetime.fromtimestamp(rls["pub_time"]),
)
for rls in r.json["list"]
]
def get_predbde(categories=("GAMES", "0DAY"), num_pages=5) -> List[Pre]:
logger.debug("Getting pres from predb.de")