Search edge case: sometimes contents is missing from API response
This commit is contained in:
parent
4eb81b8a77
commit
ac2da52177
1 changed files with 4 additions and 0 deletions
|
|
@ -120,6 +120,10 @@ class YTMusic:
|
|||
response = self.__send_request(endpoint, body)
|
||||
|
||||
try:
|
||||
# no results
|
||||
if 'contents' not in response:
|
||||
return search_results
|
||||
|
||||
if 'tabbedSearchResultsRenderer' in response['contents']:
|
||||
results = response['contents']['tabbedSearchResultsRenderer']['tabs'][0]['tabRenderer']['content']
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue