aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-07-02 21:55:39 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-07-02 21:55:39 -0700
commit7c4298217bf07dc543c8183c61fee7d63ccecfa1 (patch)
treee503ea09bda8954616a43da1278eeed0b8c9ebe1
parent49f10cb89ac458270a2ff5a48b2211e5d2c159ab (diff)
downloadyt-local-7c4298217bf07dc543c8183c61fee7d63ccecfa1.tar.lz
yt-local-7c4298217bf07dc543c8183c61fee7d63ccecfa1.tar.xz
yt-local-7c4298217bf07dc543c8183c61fee7d63ccecfa1.zip
get_text: return blank text when 'runs' is empty
-rw-r--r--youtube/common.py4
1 files changed, 4 insertions, 0 deletions
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: