|
|
|
@ -33,10 +33,10 @@ class Comments:
|
|
|
|
|
|
|
|
|
|
self._send_notification(notify)
|
|
|
|
|
comments_raw, channel_id = self.get_yt_comments()
|
|
|
|
|
if comments_raw:
|
|
|
|
|
if not comments_raw and not channel_id:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
self.format_comments(comments_raw)
|
|
|
|
|
else:
|
|
|
|
|
self.comments_format = []
|
|
|
|
|
|
|
|
|
|
self.json_data = {
|
|
|
|
|
"youtube_id": self.youtube_id,
|
|
|
|
@ -96,6 +96,9 @@ class Comments:
|
|
|
|
|
"""get comments from youtube"""
|
|
|
|
|
yt_obs = self.build_yt_obs()
|
|
|
|
|
info_json = YtWrap(yt_obs).extract(self.youtube_id)
|
|
|
|
|
if not info_json:
|
|
|
|
|
return False, False
|
|
|
|
|
|
|
|
|
|
comments_raw = info_json.get("comments")
|
|
|
|
|
channel_id = info_json.get("channel_id")
|
|
|
|
|
return comments_raw, channel_id
|
|
|
|
@ -104,6 +107,7 @@ class Comments:
|
|
|
|
|
"""process comments to match format"""
|
|
|
|
|
comments = []
|
|
|
|
|
|
|
|
|
|
if comments_raw:
|
|
|
|
|
for comment in comments_raw:
|
|
|
|
|
cleaned_comment = self.clean_comment(comment)
|
|
|
|
|
comments.append(cleaned_comment)
|
|
|
|
@ -169,6 +173,9 @@ class Comments:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
self.build_json()
|
|
|
|
|
if not self.json_data:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
es_comments = self.get_es_comments()
|
|
|
|
|
|
|
|
|
|
if not self.comments_format:
|
|
|
|
|