add fallback for #799 (#800)

This commit is contained in:
sigma67 2025-08-17 08:45:58 +02:00 • committed by GitHub
commit b4507be23b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,7 +34,9 @@ def get_search_result_type(result_type_local: str, result_types_local: list[str]
def parse_top_result(data: JsonDict, search_result_types: list[str]) -> JsonDict:
result_type = get_search_result_type(nav(data, SUBTITLE), search_result_types)
search_result = {"category": nav(data, CARD_SHELF_TITLE), "resultType": result_type}
# header element is missing in some edge cases (#799)
category = nav(data, CARD_SHELF_TITLE, True) or "Top result"
search_result = {"category": category, "resultType": result_type}
if result_type == "artist":
subscribers = nav(data, SUBTITLE2, True)
if subscribers: