Skip to content

Commit

Permalink
playlist search result "itemCount" field cast to int (#589)
Browse files Browse the repository at this point in the history
* playlist search result "itemCount" field cast to int

* use to_int

---------

Co-authored-by: sigma67 <sigma67.github@gmail.com>
  • Loading branch information
ryanopily and sigma67 committed May 25, 2024
1 parent 1f4332a commit bd51238
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ytmusicapi/parsers/search.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from ..helpers import to_int
from ._utils import *
from .songs import *

Expand Down Expand Up @@ -97,7 +98,9 @@ def parse_search_result(data, search_result_types, result_type, category):
elif result_type == "playlist":
flex_item = get_flex_column_item(data, 1)["text"]["runs"]
has_author = len(flex_item) == default_offset + 3
search_result["itemCount"] = get_item_text(data, 1, default_offset + has_author * 2).split(" ")[0]
search_result["itemCount"] = to_int(
get_item_text(data, 1, default_offset + has_author * 2).split(" ")[0]
)
search_result["author"] = None if not has_author else get_item_text(data, 1, default_offset)

elif result_type == "station":
Expand Down

0 comments on commit bd51238

Please sign in to comment.