diff options
Diffstat (limited to 'providers/Facebook.php')
-rw-r--r-- | providers/Facebook.php | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/providers/Facebook.php b/providers/Facebook.php index 4f4c76e..beb8f98 100644 --- a/providers/Facebook.php +++ b/providers/Facebook.php @@ -19,6 +19,10 @@ class Facebook extends \Providers\HtmlFeed { } } + protected function __getUserAgent() { + return 'curl/7.72.0'; + } + protected function _getCachePath() { return '../cache/facebook.%s'; } @@ -32,11 +36,10 @@ class Facebook extends \Providers\HtmlFeed { if (isset($this->_options['dump'])) { print($tree->html()); } - foreach ($tree->find('article') as $header) { - $data = json_decode($header->attr()['data-store'], TRUE); - if (isset($data['linkdata'])) { - $data = $data['linkdata']; - $data = json_decode(explode('page_insights.', $data)[1], TRUE); + foreach ($tree->find('#timelineBody div[data-ft]') as $header) { + $data = json_decode($header->attr()['data-ft'], TRUE); + if (isset($data['page_insights'])) { + $data = $data['page_insights']; $data = array_filter( $data, function($a) { return isset($a['post_context']); } |