Add predb.de and predb.ovh
This commit is contained in:
parent
f29531c723
commit
fae03e5e43
|
@ -18,7 +18,7 @@ def get_pres() -> List[Pre]:
|
|||
logger.info("Getting pres from predbs")
|
||||
|
||||
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:
|
||||
pres.update(
|
||||
(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 [
|
||||
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 page in range(1, num_pages)
|
||||
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"]
|
||||
]
|
||||
|
|
Reference in a new issue