From 29a385d1884de4caa0c4245a15b771b6c62d22ae Mon Sep 17 00:00:00 2001 From: Dimitri Molenaars Date: Wed, 21 May 2014 15:27:20 +0200 Subject: [PATCH] [YouTube]Remove 'something went wrong' error, print the correct variable. --- youtube.py | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/youtube.py b/youtube.py index 5a5d0024ce..638138fd46 100644 --- a/youtube.py +++ b/youtube.py @@ -30,24 +30,18 @@ def setup(bot): def ytget(bot, trigger, uri): - try: - bytes = web.get(uri) - result = json.loads(bytes) - if 'feed' in result: - try: - video_entry = result['feed']['entry'][0] - except KeyError: - #Issue 544, caused by searches with a hyphen. - bot.say('Something went wrong when reading YouTube '+ - 'API data.') - bot.debug('YT','Search result from %s: %s' % - (trigger.sender, video_entry), 'info') - return 'err' - else: - video_entry = result['entry'] - except: - bot.say('Something went wrong when accessing the YouTube API.') - return 'err' + bytes = web.get(uri) + result = json.loads(bytes) + if 'feed' in result: + try: + video_entry = result['feed']['entry'][0] + except KeyError: + #Issue 544, caused by searches with a hyphen. + bot.debug('YT','Search result from %s: %s' % + (trigger.sender, result['feed']), 'info') + raise + else: + video_entry = result['entry'] vid_info = {} try: # The ID format is tag:youtube.com,2008:video:RYlCVwxoL_g