|
@@ -22,11 +22,13 @@ def get_post_by_doc(response):
|
|
|
|
|
|
actor = jsonpath.jsonpath(data, '$..comet_sections.context_layout.story.comet_sections.actor_photo.story.actors[0]')[0]
|
|
|
actor = {k: v for k, v in actor.items() if k in user_require_fields}
|
|
|
+ image_candidates = jsonpath.jsonpath(data, '$..styles.attachment.all_subattachments.nodes')
|
|
|
+ photo_meida_candidate = jsonpath.jsonpath(data, '$..styles.attachment.media')
|
|
|
+ attachments = image_candidates[0] if image_candidates else photo_meida_candidate
|
|
|
result = {
|
|
|
'text': content_story['message']['text'],
|
|
|
- 'attachments': jsonpath.jsonpath(data, '$..styles.attachment.all_subattachments.nodes')[0],
|
|
|
+ 'attachments': attachments,
|
|
|
'post_id': content_story['post_id'],
|
|
|
-
|
|
|
'actor': actor,
|
|
|
'creation_time': jsonpath.jsonpath(data, '$..comet_sections.context_layout.story.comet_sections.metadata[0].story.creation_time')[0],
|
|
|
'id': content_story['id'],
|