refac use comment_comments for comment count update

This commit is contained in:
Simon 2025-12-17 21:58:36 +07:00
parent b04e3a935d
commit 2d40a340ea
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 3 additions and 4 deletions

View File

@ -142,14 +142,13 @@ class Comments:
def upload_comments(self):
"""upload comments to es"""
if not self.is_activated:
return
print(f"{self.youtube_id}: upload comments")
_, _ = ElasticWrap(self.es_path).put(self.json_data)
vid_path = f"ta_video/_update/{self.youtube_id}"
data = {"doc": {"comment_count": len(self.comments_format)}}
data = {
"doc": {"comment_count": len(self.json_data["comment_comments"])}
}
_, _ = ElasticWrap(vid_path).post(data=data)
def delete_comments(self):