aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-08-30 20:01:36 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-08-30 20:02:00 -0700
commit8cf42ed00b9c570100ef7013204d53e732159968 (patch)
treece06867674f7f752c969609c9c386675707a58ed
parentfee24d4f0a3ddcf877facfa9b22d470bee37ee79 (diff)
downloadyt-local-8cf42ed00b9c570100ef7013204d53e732159968.tar.lz
yt-local-8cf42ed00b9c570100ef7013204d53e732159968.tar.xz
yt-local-8cf42ed00b9c570100ef7013204d53e732159968.zip
Fix blank comments causing parsing to fail
-rw-r--r--youtube/comments.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube/comments.py b/youtube/comments.py
index 9d9a9c0..5490938 100644
--- a/youtube/comments.py
+++ b/youtube/comments.py
@@ -197,7 +197,7 @@ def parse_comments_polymer(content, replies=False):
'author_avatar': comment_raw['authorThumbnail']['thumbnails'][0]['url'],
'likes': comment_raw['likeCount'],
'published': common.get_plain_text(comment_raw['publishedTimeText']),
- 'text': comment_raw['contentText']['runs'],
+ 'text': comment_raw['contentText'].get('runs', ''),
'view_replies_text': view_replies_text,
'replies_url': replies_url,
}
@@ -206,6 +206,7 @@ def parse_comments_polymer(content, replies=False):
print('Error parsing comments: ' + str(e))
comments = ()
ctoken = ''
+ raise
else:
print("Finished getting and parsing comments")
return {'ctoken': ctoken, 'comments': comments, 'video_title': video_title}