comment_archive_entry.py 583 B

123456789101112131415161718192021
  1. #!/usr/bin/env python3
  2. # coding=utf-8
  3. import logging
  4. import praw.models
  5. from bdfr.archive_entry.base_archive_entry import BaseArchiveEntry
  6. logger = logging.getLogger(__name__)
  7. class CommentArchiveEntry(BaseArchiveEntry):
  8. def __init__(self, comment: praw.models.Comment):
  9. super(CommentArchiveEntry, self).__init__(comment)
  10. def compile(self) -> dict:
  11. self.source.refresh()
  12. self.post_details = self._convert_comment_to_dict(self.source)
  13. self.post_details['submission_title'] = self.source.submission.title
  14. return self.post_details