fix(iP): Update search API

This commit is contained in:
Stabby 2025-01-17 10:36:27 +01:00
parent 1fe698966f
commit 65bd6ddd56
2 changed files with 10 additions and 12 deletions

View File

@ -79,22 +79,20 @@ class iP(Service):
self.vcodec = "H.265"
def search(self) -> Generator[SearchResult, None, None]:
params = {
"q": self.title,
"apikey": self.config["api_key"],
}
r = self.session.get(self.config["endpoints"]["search"], params=params)
r = self.session.get(self.config["endpoints"]["search"], params={"q": self.title})
r.raise_for_status()
results = r.json()
for result in results["results"]:
for result in results["new_search"]["results"]:
programme_type = result.get("type")
category = result.get("labels", {}).get("category", "")
path = "episode" if programme_type == "episode" else "episodes"
yield SearchResult(
id_=result.get("uri").split(":")[-1],
id_=result.get("id"),
title=result.get("title"),
description=result.get("synopsis"),
label="series" if result.get("type", "") == "brand" else result.get("type"),
url=result.get("url"),
description=result.get("synopses", {}).get("small"),
label=programme_type + " - " + category,
url=f"https://www.bbc.co.uk/iplayer/{path}/{result.get('id')}",
)
def get_titles(self) -> Union[Movies, Series]:

View File

@ -8,4 +8,4 @@ endpoints:
playlist: https://www.bbc.co.uk/programmes/{pid}/playlist.json
open: https://{}/mediaselector/6/select/version/2.0/mediaset/{}/vpid/{}/
secure: https://{}/mediaselector/6/select/version/2.0/vpid/{}/format/json/mediaset/{}/proto/https
search: https://search.api.bbci.co.uk/formula/iplayer-ibl-root
search: https://ibl.api.bbc.co.uk/ibl/v1/new-search