diff options
Diffstat (limited to 'providers')
-rw-r--r-- | providers/Facebook.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/providers/Facebook.php b/providers/Facebook.php index 24645c7..f42e32c 100644 --- a/providers/Facebook.php +++ b/providers/Facebook.php @@ -34,10 +34,12 @@ class Facebook extends \Providers\HtmlFeed { } foreach ($tree->find('article') as $header) { $data = json_decode($header->attr()['data-store'], TRUE)['linkdata']; - $data = array_filter( - json_decode(explode('page_insights.', $data)[1], TRUE), + $data = json_decode(explode('page_insights.', $data)[1], TRUE); + $data = array_pop(array_filter( + $data, function($a) { return isset($a['post_context']); } - )['post_context']; + )); + $data = $data['post_context']; $key = $data['story_fbid']; $texts = []; foreach ($header->find('p, h3') as $paragraph) { |