From 56fdc48532b17edc7a835388eef4b7cfafbe5b8f Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 31 Jan 2019 23:34:26 +0100 Subject: Facebook is so retarded, you need to impersonate Firefox to get anything --- providers/Facebook.php | 7 ++++++- providers/HtmlFeed.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/providers/Facebook.php b/providers/Facebook.php index b1a6291..5698b93 100644 --- a/providers/Facebook.php +++ b/providers/Facebook.php @@ -7,7 +7,8 @@ require_once('Item.php'); class Facebook extends \Providers\HtmlFeed { - protected $_cacheTimeout = '5 minutes'; + //protected $_cacheTimeout = '5 minutes'; + protected $_cacheTimeout = '1 second'; protected function _getCachePath() { return '../cache/facebook.%s'; @@ -17,6 +18,10 @@ class Facebook extends \Providers\HtmlFeed { return sprintf('https://m.facebook.com/%s', $feed); } + protected function __getUserAgent() { + return 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0'; + } + protected function _parseFeedContent($tree) { $items = []; foreach ($tree->find('div[data-ft]') as $div) { diff --git a/providers/HtmlFeed.php b/providers/HtmlFeed.php index 64d6259..8543444 100644 --- a/providers/HtmlFeed.php +++ b/providers/HtmlFeed.php @@ -9,7 +9,7 @@ abstract class HtmlFeed extends \Providers\XmlFeed { private $_encoding; - private function __getUserAgent() { + protected function __getUserAgent() { return trim(file_get_contents('../config/user-agent')); } -- cgit v1.2.3