diff options
author | emkael <emkael@tlen.pl> | 2019-01-31 23:34:26 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-01-31 23:34:26 +0100 |
commit | 56fdc48532b17edc7a835388eef4b7cfafbe5b8f (patch) | |
tree | 37301267d3c1574e7225d84e81c298ee5ce13996 | |
parent | 5cd43d99b6e9f8006956a4a79f48b38180dae73b (diff) |
Facebook is so retarded, you need to impersonate Firefox to get anything
-rw-r--r-- | providers/Facebook.php | 7 | ||||
-rw-r--r-- | 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')); } |