From 7c4298217bf07dc543c8183c61fee7d63ccecfa1 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Mon, 2 Jul 2018 21:55:39 -0700 Subject: get_text: return blank text when 'runs' is empty --- youtube/common.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'youtube') diff --git a/youtube/common.py b/youtube/common.py index 3133fed..c65f545 100644 --- a/youtube/common.py +++ b/youtube/common.py @@ -371,7 +371,11 @@ def get_text(node): try: return node['simpleText'] except KeyError: + pass + try: return node['runs'][0]['text'] + except IndexError: # empty text runs + return '' def get_formatted_text(node): try: -- cgit v1.2.3