1
0
Fork 0

Add predb.de and predb.ovh

This commit is contained in:
Casper V. Kristensen 2022-06-12 18:53:36 +02:00
parent f29531c723
commit fae03e5e43

View file

@ -18,7 +18,7 @@ def get_pres() -> List[Pre]:
logger.info("Getting pres from predbs") logger.info("Getting pres from predbs")
pres = {} pres = {}
for get in (get_predbme, get_xrel): # in reverse order of preference for get in (get_predbovh, get_predbde, get_xrel): # in reverse order of preference
try: try:
pres.update( pres.update(
(p.dirname, p) for p in get() (p.dirname, p) for p in get()
@ -46,8 +46,55 @@ def get_xrel(categories=("CRACKED", "UPDATE"), num_pages=2) -> List[Pre]:
return r.json["list"] return r.json["list"]
return [ return [
Pre(rls["dirname"], rls["link_href"], datetime.fromtimestamp(rls["time"])) Pre(
dirname=rls["dirname"],
nfo_link=rls["link_href"],
timestamp=datetime.fromtimestamp(rls["time"]),
)
for category in categories for category in categories
for page in range(1, num_pages) for page in range(1, num_pages)
for rls in get_releases_in_category(category, page) for rls in get_releases_in_category(category, page)
] ]
def get_predbde(categories=("GAMES", "0DAY"), num_pages=5) -> List[Pre]:
logger.debug("Getting pres from predb.de")
def get_releases_in_category(category, page):
r = cache.get(
"https://predb.de/api/",
params={"type": "section", "q": category, "page": page},
)
return r.json["data"]
return [
Pre(
dirname=rls["release"],
nfo_link="https://predb.de/rls/{}".format(rls["release"]),
timestamp=datetime.fromtimestamp(float(rls["pretime"])),
)
for category in categories
for page in range(1, num_pages)
for rls in get_releases_in_category(category, page)
]
def get_predbovh() -> List[Pre]:
logger.debug("Getting pres from predb.ovh")
r = cache.get(
"https://predb.ovh/api/v1/",
params={
"q": "@cat GAMES|0DAY",
"count": 100,
},
)
return [
Pre(
dirname=rls["name"],
nfo_link="https://duckduckgo.com/?q={}".format(rls["name"]),
timestamp=datetime.fromtimestamp(rls["preAt"]),
)
for rls in r.json["data"]["rows"]
]