def _parse_author(self, json_content): author = Author() post_id = json_content["id"] author.name = post_id author.author_screen_name = post_id author.author_osn_id = post_id author.domain = self._domain str_post_timestamp = json_content["postTimestamp"] post_timestamp, str_post_date = self._get_str_and_date_formats( str_post_timestamp) author.created_at = str(str_post_date) post_guid = compute_post_guid(self._social_network_url, post_id, str_post_date) author.author_guid = post_guid if post_id in self._post_id_targeted_class_dict: targeted_class = self._post_id_targeted_class_dict[post_id] author.author_type = targeted_class post_media = json_content["postMedia"] if len(post_media) > 0: author.media_path = post_media[0] else: author.media_path = None author.notifications = self._dataset_type return author
def _create_author(self, post, dataset_affiliation): author = Author() author_name = post.author author.name = author_name author.author_screen_name = author_name author_guid = compute_author_guid_by_author_name(author_name) author.author_osn_id = author_guid author.author_guid = author_guid author.domain = self._domain author.author_type = post.post_type author.notifications = dataset_affiliation return author