Repository: sigma67/ytmusicapi

Issue #121: search fails with 'list index out of range'
Created: 2020-12-16T02:29:55Z
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-2-228b7e527447> in <module>()
      1 query = "smashing pumpkins"
----> 2 results = ytmusic.search(query)

/usr/local/lib/python3.6/dist-packages/ytmusicapi/parsers/utils.py in get_flex_column_item(item, index)
     34 
     35 def get_flex_column_item(item, index):
---> 36     if 'text' not in item['flexColumns'][index]['musicResponsiveListItemFlexColumnRenderer'] or \
     37             'runs' not in item['flexColumns'][index]['musicResponsiveListItemFlexColumnRenderer']['text']:
     38         return None

IndexError: list index out of range

Tried different queries and also tried with both 0.10.2 and 0.11.0 versions

Duplicate issue #122: IndexError: list index out of range in search function
Created: 2020-12-16T02:32:48Z
I'm not sure why this is happening now. I have scanned these files at least 3 times before without issue.
I am on MacOS 10.14.6 (18G6042)
python version: 3.9.0
and latest master version of ytmusicapi
Traceback (most recent call last):
  File "/Users/phire/Documents/python projects/ytmusic-sync/./sync.py", line 189, in <module>
    processFile(os.path.join(dirName,filename), False)
    │           │            │       └ '05 Bright Eyes.flac'
    │           │            └ '/music/declan/Thank You'
    │           └ <module 'os' from '/usr/local/Cellar/python@3.9/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os.py'>
    └ <function processFile at 0x108df51f0>
  File "/Users/phire/Documents/python projects/ytmusic-sync/./sync.py", line 99, in processFile
    song = searchYT(f'{artist} - {title}', 'songs', title, artist, track.info.length)
           │           │          │                 │      │       
           │           │          │                 │      └ 'Declan'
           │           │          │                 └ 'Bright Eyes'
           │           │          └ 'Bright Eyes'
           │           └ 'Declan'
           └ <function searchYT at 0x108df5310>
  File "/Users/phire/Documents/python projects/ytmusic-sync/./sync.py", line 117, in searchYT
    results = ytmusic.search(query, type, 50)
              │              │      └ 'songs'
              │              └ 'Declan - Bright Eyes'
              └ <ytmusicapi.ytmusic.YTMusic object at 0x108dd3a30>
  File "/usr/local/lib/python3.9/site-packages/ytmusicapi-0.11.0-py3.9.egg/ytmusicapi/mixins/browsing.py", line 119, in search
    search_results.extend(self.parser.parse_search_results(results, type))
    │                     │                                │        └ 'song'
    │                     │                                └ [{'musicResponsiveListItemRenderer': {'trackingParams': 'CJUCEOFnGAAiEwjOhe3LtdHtAhVGicQKHf-QCms=', 'thumbnail': {'musicThumbnai...
    │                     └ <ytmusicapi.ytmusic.YTMusic object at 0x108dd3a30>
    └ []
  File "/usr/local/lib/python3.9/site-packages/ytmusicapi-0.11.0-py3.9.egg/ytmusicapi/helpers.py", line 78, in _impl
    return method(self, *method_args, **method_kwargs)
           │      │      │              └ {}
           │      │      └ ([{'musicResponsiveListItemRenderer': {'trackingParams': 'CJUCEOFnGAAiEwjOhe3LtdHtAhVGicQKHf-QCms=', 'thumbnail': {'musicThumbna...
           │      └ <ytmusicapi.parsers.browsing.Parser object at 0x108111190>
           └ <function Parser.parse_search_results at 0x108dc3c10>
  File "/usr/local/lib/python3.9/site-packages/ytmusicapi-0.11.0-py3.9.egg/ytmusicapi/parsers/browsing.py", line 56, in parse_search_results
    search_result['duration'] = get_item_text(data, 2 + hasAlbum + default)
    │                           │             │         │          └ False
    │                           │             │         └ False
    │                           │             └ {'trackingParams': 'CJUCEOFnGAAiEwjOhe3LtdHtAhVGicQKHf-QCms=', 'thumbnail': {'musicThumbnailRenderer': {'thumbnail': {'thumbnail...
    │                           └ <function get_item_text at 0x108dc33a0>
    └ {'resultType': 'song', 'videoId': 'Ap_iLn1lEE8', 'title': 'Bright Eyes', 'artists': [{'name': 'Declan', 'id': 'UCC7LIUytm0ml07W6...
  File "/usr/local/lib/python3.9/site-packages/ytmusicapi-0.11.0-py3.9.egg/ytmusicapi/parsers/utils.py", line 44, in get_item_text
    column = get_flex_column_item(item, index)
             │                    │     └ 2
             │                    └ {'trackingParams': 'CJUCEOFnGAAiEwjOhe3LtdHtAhVGicQKHf-QCms=', 'thumbnail': {'musicThumbnailRenderer': {'thumbnail': {'thumbnail...
             └ <function get_flex_column_item at 0x108dc3430>
  File "/usr/local/lib/python3.9/site-packages/ytmusicapi-0.11.0-py3.9.egg/ytmusicapi/parsers/utils.py", line 53, in get_flex_column_item
    if 'text' not in item['flexColumns'][index]['musicResponsiveListItemFlexColumnRenderer'] or \
IndexError: list index out of range

Closing comment (2020-12-16T08:26:37Z): Related to a recent update by YouTube, which apparently got pushed last night. Duplicates #121, so I'll close this one.