diff --git a/tidalapi/page.py b/tidalapi/page.py index 6a046b1..5914d6f 100644 --- a/tidalapi/page.py +++ b/tidalapi/page.py @@ -181,9 +181,9 @@ def parse(self, json_obj: JsonObj) -> AllCategories: elif category_type == "ARTIST_HEADER": result = self.session.parse_artist(json_obj["artist"]) result.bio = json_obj["bio"] - return result + return ItemHeader(result) elif category_type == "ALBUM_HEADER": - return self.session.parse_album(json_obj["album"]) + return ItemHeader(self.session.parse_album(json_obj["album"])) elif category_type == "HIGHLIGHT_MODULE": category = ItemList(self.session) elif category_type == "MIXED_TYPES_LIST": @@ -362,6 +362,8 @@ def get(self) -> Union["Artist", "Playlist", "Track", "UserPlaylist", "Video"]: return self.session.track(self.artifact_id) elif self.type == "ARTIST": return self.session.artist(self.artifact_id) + elif self.type == "ALBUM": + return self.session.album(self.artifact_id) raise NotImplementedError(f"PageItem type {self.type} not implemented") @@ -397,3 +399,12 @@ def parse(self, json_obj: JsonObj) -> "LinkList": self.description = json_obj["description"] return copy.copy(self) + + +class ItemHeader(object): + """Single item in a "category" of the page.""" + + items: Optional[List[Any]] = None + + def __init__(self, item: Any): + self.items = [item]