playlist search result "itemCount" field cast to int (#589)

* playlist search result "itemCount" field cast to int

* use to_int

---------

Co-authored-by: sigma67 <sigma67.github@gmail.com>
This commit is contained in:
ryanopily 2024-05-25 04:16:01 -04:00 • committed by GitHub
commit bd512384d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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":