From bd512384d94778f620c1ef2cbf2ad8176a4b02ff Mon Sep 17 00:00:00 2001 From: ryanopily Date: Sat, 25 May 2024 04:16:01 -0400 Subject: [PATCH] playlist search result "itemCount" field cast to int (#589) * playlist search result "itemCount" field cast to int * use to_int --------- Co-authored-by: sigma67 --- ytmusicapi/parsers/search.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ytmusicapi/parsers/search.py b/ytmusicapi/parsers/search.py index f2efa1b..c2484d2 100644 --- a/ytmusicapi/parsers/search.py +++ b/ytmusicapi/parsers/search.py @@ -1,3 +1,4 @@ +from ..helpers import to_int from ._utils import * from .songs import * @@ -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":