Skip to content

Commit

Permalink
Correctly parse user information
Browse files Browse the repository at this point in the history
  • Loading branch information
jayjay-w committed Oct 6, 2024
1 parent 53d8054 commit 4c91d60
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/models/concerns/provider_facebook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ def format_apify_result(data)
post_info = (data)
message = post_info.dig('text')
picture = post_info && post_info.dig('media').is_a?(Array) ? post_info.dig('media').first['thumbnail'] : ""
user_id = post_info.dig('user').is_a?(Array) ? post_info.dig('user').dig('id') : ""
user_id = post_info.dig('user').is_a?(Hash) ? post_info.dig('user').dig('id') : ""
post_id = post_info.dig('postId')
{
author_name: post_info.dig('user').is_a?(Array) ? post_info.dig('user').dig('name') : "",
username: post_info.dig('user').is_a?(Array) ? post_info.dig('user').dig('name') : "",
author_url: post_info.dig('user').is_a?(Array) ? post_info.dig('user').dig('profileUrl') : "",
author_picture: post_info.dig('user').is_a?(Array) ? post_info.dig('user').dig('profilePic') : "",
author_name: post_info.dig('user').is_a?(Hash) ? post_info.dig('user').dig('name') : "",
username: post_info.dig('user').is_a?(Hash) ? post_info.dig('user').dig('name') : "",
author_url: post_info.dig('user').is_a?(Hash) ? post_info.dig('user').dig('profileUrl') : "",
author_picture: post_info.dig('user').is_a?(Hash) ? post_info.dig('user').dig('profilePic') : "",
title: message,
description: message,
text: message,
Expand Down

0 comments on commit 4c91d60

Please sign in to comment.