Skip to content

Commit fbc124a

Browse files
authored
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
1 parent 4d9e1d4 commit fbc124a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plexapi/myplex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ def searchDiscover(self, query, limit=30, libtype=None):
899899

900900
data = self.query(f'{self.METADATA}/library/search', headers=headers, params=params)
901901
searchResults = data['MediaContainer'].get('SearchResults', [])
902-
searchResult = next((s['SearchResult'] for s in searchResults if s.get('id') == 'external'), [])
902+
searchResult = next((s.get('SearchResult', []) for s in searchResults if s.get('id') == 'external'), [])
903903

904904
results = []
905905
for result in searchResult:

0 commit comments

Comments
 (0)