mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-21 19:23:05 +00:00
Fix searchDiscover
handling invalid results (#1013)
* Filter out bad discover search results An stub object is sometimes returned from the API that is marked as `'external'` but has has no `'SearchResults'` key. {'id': 'external', 'title': 'More Ways To Watch', 'size': 0} * Wrap line to fit 127c * Ensure empty array for SearchResult
This commit is contained in:
parent
4d9e1d4f14
commit
fbc124aa57
1 changed files with 1 additions and 1 deletions
|
@ -899,7 +899,7 @@ class MyPlexAccount(PlexObject):
|
|||
|
||||
data = self.query(f'{self.METADATA}/library/search', headers=headers, params=params)
|
||||
searchResults = data['MediaContainer'].get('SearchResults', [])
|
||||
searchResult = next((s['SearchResult'] for s in searchResults if s.get('id') == 'external'), [])
|
||||
searchResult = next((s.get('SearchResult', []) for s in searchResults if s.get('id') == 'external'), [])
|
||||
|
||||
results = []
|
||||
for result in searchResult:
|
||||
|
|
Loading…
Reference in a new issue