Skip to content

Commit

Permalink
Merge pull request TotallyNotRobots#49 from TotallyNotRobots/gonzobot…
Browse files Browse the repository at this point in the history
…+fix-youtube-no-results

Handle empty item lists from Youtube API
  • Loading branch information
linuxdaemon authored Dec 18, 2019
2 parents 76f62f8 + 6471a42 commit 61e7984
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Disconnect active vs configured channel lists (#11)
- Fix reminder tests time based errors
- Handle empty results in YouTube API responses
- Fix .urban handling numbers in the query
- Fix the possible `-0` in weather data
- Fix random truncations of search result URLs
Expand Down
2 changes: 1 addition & 1 deletion plugins/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def get_video_id(reply, text):

return None, "Error performing search."

if json['pageInfo']['totalResults'] == 0:
if not json.get('items'):
return None, "No results found."

video_id = json['items'][0]['id']['videoId']
Expand Down

0 comments on commit 61e7984

Please sign in to comment.