Fix blank comments causing parsing to fail
This commit is contained in:
parent
fee24d4f0a
commit
8cf42ed00b
@ -197,7 +197,7 @@ def parse_comments_polymer(content, replies=False):
|
|||||||
'author_avatar': comment_raw['authorThumbnail']['thumbnails'][0]['url'],
|
'author_avatar': comment_raw['authorThumbnail']['thumbnails'][0]['url'],
|
||||||
'likes': comment_raw['likeCount'],
|
'likes': comment_raw['likeCount'],
|
||||||
'published': common.get_plain_text(comment_raw['publishedTimeText']),
|
'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,
|
'view_replies_text': view_replies_text,
|
||||||
'replies_url': replies_url,
|
'replies_url': replies_url,
|
||||||
}
|
}
|
||||||
@ -206,6 +206,7 @@ def parse_comments_polymer(content, replies=False):
|
|||||||
print('Error parsing comments: ' + str(e))
|
print('Error parsing comments: ' + str(e))
|
||||||
comments = ()
|
comments = ()
|
||||||
ctoken = ''
|
ctoken = ''
|
||||||
|
raise
|
||||||
else:
|
else:
|
||||||
print("Finished getting and parsing comments")
|
print("Finished getting and parsing comments")
|
||||||
return {'ctoken': ctoken, 'comments': comments, 'video_title': video_title}
|
return {'ctoken': ctoken, 'comments': comments, 'video_title': video_title}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user