diff --git a/services/iP/__init__.py b/services/iP/__init__.py index b02da58..03ae839 100644 --- a/services/iP/__init__.py +++ b/services/iP/__init__.py @@ -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]: diff --git a/services/iP/config.yaml b/services/iP/config.yaml index 84a3604..73aba44 100644 --- a/services/iP/config.yaml +++ b/services/iP/config.yaml @@ -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