Skip to content

Commit 74874d9

Browse files
authored
Merge pull request #354 from Nokse22/patch-1
Remove parseV2 from Page
2 parents 51dd2f7 + e1b6aaa commit 74874d9

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

tidalapi/page.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,17 @@ def parse(self, json_obj: JsonObj) -> "Page":
118118
"""Goes through everything in the page, and gets the title and adds all the rows
119119
to the categories field :param json_obj: The json to be parsed :return: A copy
120120
of the Page that you can use to browse all the items."""
121-
self.title = json_obj["title"]
122121
self.categories = []
123-
for row in json_obj["rows"]:
124-
page_item = self.page_category.parse(row["modules"][0])
125-
self.categories.append(page_item)
126-
127-
return copy.copy(self)
128122

129-
def parseV2(self, json_obj: JsonObj) -> "Page":
130-
self.categories = []
131-
for item in json_obj["items"]:
132-
page_item = self.page_category_v2.parse(item)
133-
self.categories.append(page_item)
123+
if json_obj.get("rows"):
124+
self.title = json_obj["title"]
125+
for row in json_obj["rows"]:
126+
page_item = self.page_category.parse(row["modules"][0])
127+
self.categories.append(page_item)
128+
else:
129+
for item in json_obj["items"]:
130+
page_item = self.page_category_v2.parse(item)
131+
self.categories.append(page_item)
134132

135133
return copy.copy(self)
136134

0 commit comments

Comments
 (0)