search: fix error if playlist author is missing
This commit is contained in:
parent
6825679eed
commit
641178d067
1 changed files with 6 additions and 3 deletions
|
|
@ -42,9 +42,12 @@ class Parser:
|
||||||
search_result['type'] = get_item_text(data, 1)
|
search_result['type'] = get_item_text(data, 1)
|
||||||
|
|
||||||
elif resultType == 'playlist':
|
elif resultType == 'playlist':
|
||||||
search_result['author'] = get_item_text(data, 1, default_offset)
|
flex_item = get_flex_column_item(data, 1)['text']['runs']
|
||||||
search_result['itemCount'] = get_item_text(data, 1,
|
has_author = len(flex_item) == default_offset + 3
|
||||||
default_offset + 2).split('\xa0')[0]
|
search_result['itemCount'] = nav(
|
||||||
|
flex_item, [default_offset + has_author * 2, 'text']).split(' ')[0]
|
||||||
|
search_result['author'] = None if not has_author else nav(
|
||||||
|
flex_item, [default_offset, 'text'])
|
||||||
|
|
||||||
elif resultType == 'station':
|
elif resultType == 'station':
|
||||||
search_result['videoId'] = nav(data, NAVIGATION_VIDEO_ID)
|
search_result['videoId'] = nav(data, NAVIGATION_VIDEO_ID)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue