diff --git a/autosub/__init__.py b/autosub/__init__.py index a7530755..83f437ab 100644 --- a/autosub/__init__.py +++ b/autosub/__init__.py @@ -93,15 +93,10 @@ def __call__(self, data): for line in resp.content.decode('utf-8').split("\n"): try: - if line: - line = json.loads(line) - line = line['result'][0]['alternative'][0]['transcript'] - line = line[:1].upper() + line[1:] - else: - line = None - - return line - except IndexError: + line = json.loads(line) + line = line['result'][0]['alternative'][0]['transcript'] + return line[:1].upper() + line[1:] + except (IndexError, ValueError): # no result continue except KeyboardInterrupt: