From fe3ed740576a0a744e5efff6807bf0784f2eae09 Mon Sep 17 00:00:00 2001 From: Bryan Koroleski Date: Thu, 25 Sep 2014 13:22:20 -0500 Subject: [PATCH] Accounts for situations where no videos are returned. Sometimes, Youtube will say that there is one result, but won't return anything. --- plugins/youtube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/youtube.py b/plugins/youtube.py index 404f586..8931f4b 100644 --- a/plugins/youtube.py +++ b/plugins/youtube.py @@ -75,7 +75,7 @@ def youtube(inp): if 'error' in j: return 'error while performing the search' - if j['data']['totalItems'] == 0: + if j['data']['totalItems'] == 0 or 'items' not in j['data']: return 'no results found' vid_id = j['data']['items'][0]['id']